github-actions[bot] commented on PR #29764: URL: https://github.com/apache/doris/pull/29764#issuecomment-1884102387
#### `sh-checker report` To get the full details, please check in the [job]("https://github.com/apache/doris/actions/runs/7469657899") output. <details> <summary>shellcheck errors</summary> ``` 'shellcheck ' returned error 1 finding the following syntactical issues: ---------- In tools/pick_pr.sh line 21: remote_from=`echo $branch_from | awk -F/ '{print $1}'` ^-- SC2006 (style): Use $(...) notation instead of legacy backticks `...`. ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^----------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: remote_from=$(echo "${branch_from}" | awk -F/ '{print $1}') In tools/pick_pr.sh line 24: branch_to_name=`echo $branch_to | awk -F/ '{print $2}'` ^-- SC2006 (style): Use $(...) notation instead of legacy backticks `...`. ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^--------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: branch_to_name=$(echo "${branch_to}" | awk -F/ '{print $2}') In tools/pick_pr.sh line 25: remote_to=`echo $branch_to | awk -F/ '{print $1}'` ^-- SC2006 (style): Use $(...) notation instead of legacy backticks `...`. ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^--------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: remote_to=$(echo "${branch_to}" | awk -F/ '{print $1}') In tools/pick_pr.sh line 28: push_url=`git remote get-url --push $push_remote` ^-- SC2006 (style): Use $(...) notation instead of legacy backticks `...`. ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^----------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: push_url=$(git remote get-url --push "${push_remote}") In tools/pick_pr.sh line 30: push_url=`echo $push_url | sed 's|^https://github.com/||'` ^-- SC2006 (style): Use $(...) notation instead of legacy backticks `...`. ^-------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^-------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: push_url=$(echo "${push_url}" | sed 's|^https://github.com/||') In tools/pick_pr.sh line 32: push_url=`echo $push_url | sed 's|^g...@github.com:||'` ^-- SC2006 (style): Use $(...) notation instead of legacy backticks `...`. ^-------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^-------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: push_url=$(echo "${push_url}" | sed 's|^g...@github.com:||') In tools/pick_pr.sh line 34: push_id=`echo $push_url | awk -F/ '{print $1}'` ^-- SC2006 (style): Use $(...) notation instead of legacy backticks `...`. ^-------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^-------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: push_id=$(echo "${push_url}" | awk -F/ '{print $1}') In tools/pick_pr.sh line 39: echo "step1: git fetch to update local git repos $remote_from and $remote_to" ^----------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. ^--------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: echo "step1: git fetch to update local git repos ${remote_from} and ${remote_to}" In tools/pick_pr.sh line 40: git fetch $remote_from ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^----------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: git fetch "${remote_from}" In tools/pick_pr.sh line 41: git fetch $remote_to ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^--------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: git fetch "${remote_to}" In tools/pick_pr.sh line 45: echo "step2: get pr $pr commit id using gh cli" ^-^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: echo "step2: get pr ${pr} commit id using gh cli" In tools/pick_pr.sh line 46: commitid=`gh pr view $pr --repo $doris_repo --json mergeCommit -t '{{.mergeCommit.oid}}'` ^-- SC2006 (style): Use $(...) notation instead of legacy backticks `...`. ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. ^-^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. ^---------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. ^---------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: commitid=$(gh pr view "${pr}" --repo "${doris_repo}" --json mergeCommit -t '{{.mergeCommit.oid}}') In tools/pick_pr.sh line 47: title=`gh pr view $pr --repo $doris_repo --json title -t '{{.title}}'` ^-- SC2006 (style): Use $(...) notation instead of legacy backticks `...`. ^-^ SC2086 (info): Double quote to prevent globbing and word splitting. ^-^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. ^---------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. ^---------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: title=$(gh pr view "${pr}" --repo "${doris_repo}" --json title -t '{{.title}}') In tools/pick_pr.sh line 48: echo "commit id for $pr is '$commitid'" ^-^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. ^-------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: echo "commit id for ${pr} is '${commitid}'" In tools/pick_pr.sh line 56: git show --stat $commitid ^-------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^-------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: git show --stat "${commitid}" In tools/pick_pr.sh line 57: if [ $? -ne 0 ] ^-- SC2181 (style): Check exit code directly with e.g. 'if ! mycmd;', not indirectly with $?. In tools/pick_pr.sh line 59: echo "git show --stat $commitid failed, $commitid is invalid" ^-------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. ^-------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: echo "git show --stat ${commitid} failed, ${commitid} is invalid" In tools/pick_pr.sh line 65: echo "step3: create local branch $branch_pick based on remote branch $branch_to" ^----------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. ^--------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: echo "step3: create local branch ${branch_pick} based on remote branch ${branch_to}" In tools/pick_pr.sh line 66: branch_pick=`echo pick_${pr}_to_${branch_to} | sed 's|/|_|g'` ^-- SC2006 (style): Use $(...) notation instead of legacy backticks `...`. ^---^ SC2086 (info): Double quote to prevent globbing and word splitting. ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: branch_pick=$(echo pick_"${pr}"_to_"${branch_to}" | sed 's|/|_|g') In tools/pick_pr.sh line 67: git checkout -b $branch_pick ${branch_to} ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^----------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: git checkout -b "${branch_pick}" "${branch_to}" In tools/pick_pr.sh line 68: if [ $? -ne 0 ] ^-- SC2181 (style): Check exit code directly with e.g. 'if ! mycmd;', not indirectly with $?. In tools/pick_pr.sh line 70: echo "git checkout -b $branch_pick ${branch_to} failed" ^----------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: echo "git checkout -b ${branch_pick} ${branch_to} failed" In tools/pick_pr.sh line 76: echo -n "step4: will run git cherry-pick $commitid , please confirm y/n: " ^-- SC3037 (warning): In POSIX sh, echo flags are undefined. ^-------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: echo -n "step4: will run git cherry-pick ${commitid} , please confirm y/n: " In tools/pick_pr.sh line 78: read ans ^--^ SC2162 (info): read without -r will mangle backslashes. In tools/pick_pr.sh line 80: if [ "$ans" == "y" ] ^--^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. ^-- SC3014 (warning): In POSIX sh, == in place of = is undefined. Did you mean: if [ "${ans}" == "y" ] In tools/pick_pr.sh line 82: git cherry-pick $commitid ^-------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^-------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: git cherry-pick "${commitid}" In tools/pick_pr.sh line 83: if [ $? -ne 0 ] ^-- SC2181 (style): Check exit code directly with e.g. 'if ! mycmd;', not indirectly with $?. In tools/pick_pr.sh line 85: echo -n "git cherry-pick return none zero $?, wait for manual processing, please confirm continue or exit c/e: " ^-- SC3037 (warning): In POSIX sh, echo flags are undefined. In tools/pick_pr.sh line 86: read ans ^--^ SC2162 (info): read without -r will mangle backslashes. In tools/pick_pr.sh line 87: if [ "$ans" != "c" ] ^--^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: if [ "${ans}" != "c" ] In tools/pick_pr.sh line 89: echo "manual processing confirm $ans is not c, git cherry-pick --abort and exit now" ^--^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: echo "manual processing confirm ${ans} is not c, git cherry-pick --abort and exit now" In tools/pick_pr.sh line 96: echo "step5: push to your remote repo $push_remote `git remote get-url --push $push_remote`" ^----------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. ^-- SC2006 (style): Use $(...) notation instead of legacy backticks `...`. ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^----------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: echo "step5: push to your remote repo ${push_remote} $(git remote get-url --push "${push_remote}")" In tools/pick_pr.sh line 97: git push $push_remote ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^----------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: git push "${push_remote}" In tools/pick_pr.sh line 101: newpr_url=`gh pr create --repo $doris_repo --base $branch_to_name --head ${push_id}:${branch_pick} --title "$title #${pr}" --body "cherry pick from #${pr}"` ^-- SC2006 (style): Use $(...) notation instead of legacy backticks `...`. ^---------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. ^---------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. ^-------------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^-------------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^----^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: newpr_url=$(gh pr create --repo "${doris_repo}" --base "${branch_to_name}" --head "${push_id}":"${branch_pick}" --title "${title} #${pr}" --body "cherry pick from #${pr}") In tools/pick_pr.sh line 102: echo "new pr url: $newpr_url" ^--------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: echo "new pr url: ${newpr_url}" In tools/pick_pr.sh line 106: newpr=`echo $newpr_url | awk -F/ '{print $NF}'` ^-- SC2006 (style): Use $(...) notation instead of legacy backticks `...`. ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^--------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: newpr=$(echo "${newpr_url}" | awk -F/ '{print $NF}') In tools/pick_pr.sh line 107: if [ "$newpr" != "" ] ^----^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: if [ "${newpr}" != "" ] In tools/pick_pr.sh line 109: gh pr comment --repo $doris_repo $newpr --body 'run buildall' ^---------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. ^---------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. ^----^ SC2086 (info): Double quote to prevent globbing and word splitting. ^----^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: gh pr comment --repo "${doris_repo}" "${newpr}" --body 'run buildall' In tools/pick_pr.sh line 112: echo "do nothing for $pr" ^-^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: echo "do nothing for ${pr}" For more information: https://www.shellcheck.net/wiki/SC3014 -- In POSIX sh, == in place of = is ... https://www.shellcheck.net/wiki/SC3037 -- In POSIX sh, echo flags are undef... https://www.shellcheck.net/wiki/SC2086 -- Double quote to prevent globbing ... ---------- You can address the above issues in one of three ways: 1. Manually correct the issue in the offending shell script; 2. Disable specific issues by adding the comment: # shellcheck disable=NNNN above the line that contains the issue, where NNNN is the error code; 3. Add '-e NNNN' to the SHELLCHECK_OPTS setting in your .yml action file. ``` </details> <details> <summary>shfmt errors</summary> ``` 'shfmt ' returned error 1 finding the following formatting issues: ---------- --- tools/pick_pr.sh.orig +++ tools/pick_pr.sh @@ -1,50 +1,45 @@ #!/bin/sh -if [ $# -ne 4 ] -then +if [ $# -ne 4 ]; then echo "usage: $0 <branch_from> <branch_to> <git_push_remote> <pr_number>" - echo - echo " branch_from/to syntax: local_git_remote_name/branch_name eg: upstream/master upstream/branch-2.0" - echo " git_push_remote syntax: local_git_remote_name eg: origin your_name" - echo " use 'git remote -v' to get list of local_git_remote_name" - echo - echo " NOTICE: This script depends on github cli tool 'gh', which can be get from https://cli.github.com/" - echo " You need to login using 'gh auth login'. It will ask your github token, which can be generated at https://github.com/settings/tokens" + echo + echo " branch_from/to syntax: local_git_remote_name/branch_name eg: upstream/master upstream/branch-2.0" + echo " git_push_remote syntax: local_git_remote_name eg: origin your_name" + echo " use 'git remote -v' to get list of local_git_remote_name" + echo + echo " NOTICE: This script depends on github cli tool 'gh', which can be get from https://cli.github.com/" + echo " You need to login using 'gh auth login'. It will ask your github token, which can be generated at https://github.com/settings/tokens" exit 1 fi doris_repo='apache/doris' - - branch_from=$1 -remote_from=`echo $branch_from | awk -F/ '{print $1}'` +remote_from=$(echo $branch_from | awk -F/ '{print $1}') branch_to=$2 -branch_to_name=`echo $branch_to | awk -F/ '{print $2}'` -remote_to=`echo $branch_to | awk -F/ '{print $1}'` +branch_to_name=$(echo $branch_to | awk -F/ '{print $2}') +remote_to=$(echo $branch_to | awk -F/ '{print $1}') push_remote=$3 -push_url=`git remote get-url --push $push_remote` +push_url=$(git remote get-url --push $push_remote) # https://github.com/your_name/doris.git -push_url=`echo $push_url | sed 's|^https://github.com/||'` +push_url=$(echo $push_url | sed 's|^https://github.com/||') # g...@github.com:your_name/doris.git -push_url=`echo $push_url | sed 's|^g...@github.com:||'` +push_url=$(echo $push_url | sed 's|^g...@github.com:||') # get your_name -push_id=`echo $push_url | awk -F/ '{print $1}'` +push_id=$(echo $push_url | awk -F/ '{print $1}') pr=$4 - echo "step1: git fetch to update local git repos $remote_from and $remote_to" git fetch $remote_from git fetch $remote_to - echo echo "step2: get pr $pr commit id using gh cli" -commitid=`gh pr view $pr --repo $doris_repo --json mergeCommit -t '{{.mergeCommit.oid}}'` -title=`gh pr view $pr --repo $doris_repo --json title -t '{{.title}}'` +commitid=$(gh pr view $pr --repo $doris_repo --json mergeCommit -t '{{.mergeCommit.oid}}') +title=$(gh pr view $pr --repo $doris_repo --json title -t '{{.title}}') echo "commit id for $pr is '$commitid'" # len=`echo -n $commitid | wc -c` # if [ "$len" != "40" ] @@ -54,22 +49,20 @@ # exit 2 # fi git show --stat $commitid -if [ $? -ne 0 ] -then - echo "git show --stat $commitid failed, $commitid is invalid" - echo - exit 2 +if [ $? -ne 0 ]; then + echo "git show --stat $commitid failed, $commitid is invalid" + echo + exit 2 fi echo echo "step3: create local branch $branch_pick based on remote branch $branch_to" -branch_pick=`echo pick_${pr}_to_${branch_to} | sed 's|/|_|g'` +branch_pick=$(echo pick_${pr}_to_${branch_to} | sed 's|/|_|g') git checkout -b $branch_pick ${branch_to} -if [ $? -ne 0 ] -then - echo "git checkout -b $branch_pick ${branch_to} failed" - echo - exit 3 +if [ $? -ne 0 ]; then + echo "git checkout -b $branch_pick ${branch_to} failed" + echo + exit 3 fi echo @@ -77,39 +70,34 @@ read ans echo -if [ "$ans" == "y" ] -then +if [ "$ans" == "y" ]; then git cherry-pick $commitid - if [ $? -ne 0 ] - then - echo -n "git cherry-pick return none zero $?, wait for manual processing, please confirm continue or exit c/e: " - read ans - if [ "$ans" != "c" ] - then - echo "manual processing confirm $ans is not c, git cherry-pick --abort and exit now" - git cherry-pick --abort - exit 4 - fi - fi + if [ $? -ne 0 ]; then + echo -n "git cherry-pick return none zero $?, wait for manual processing, please confirm continue or exit c/e: " + read ans + if [ "$ans" != "c" ]; then + echo "manual processing confirm $ans is not c, git cherry-pick --abort and exit now" + git cherry-pick --abort + exit 4 + fi + fi - echo - echo "step5: push to your remote repo $push_remote `git remote get-url --push $push_remote`" - git push $push_remote - - echo - echo "step6: create pr using gh cli" - newpr_url=`gh pr create --repo $doris_repo --base $branch_to_name --head ${push_id}:${branch_pick} --title "$title #${pr}" --body "cherry pick from #${pr}"` - echo "new pr url: $newpr_url" - - echo - echo "step7: comment 'run buildall' to trigger tests using gh cli" - newpr=`echo $newpr_url | awk -F/ '{print $NF}'` - if [ "$newpr" != "" ] - then - gh pr comment --repo $doris_repo $newpr --body 'run buildall' - fi + echo + echo "step5: push to your remote repo $push_remote $(git remote get-url --push $push_remote)" + git push $push_remote + + echo + echo "step6: create pr using gh cli" + newpr_url=$(gh pr create --repo $doris_repo --base $branch_to_name --head ${push_id}:${branch_pick} --title "$title #${pr}" --body "cherry pick from #${pr}") + echo "new pr url: $newpr_url" + + echo + echo "step7: comment 'run buildall' to trigger tests using gh cli" + newpr=$(echo $newpr_url | awk -F/ '{print $NF}') + if [ "$newpr" != "" ]; then + gh pr comment --repo $doris_repo $newpr --body 'run buildall' + fi else echo "do nothing for $pr" - exit 5 + exit 5 fi - ---------- You can reformat the above files to meet shfmt's requirements by typing: shfmt -w filename ``` </details> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org