github-actions[bot] commented on PR #18587:
URL: https://github.com/apache/doris/pull/18587#issuecomment-1504833248

   #### `sh-checker report`
   
   To get the full details, please check in the 
[job]("https://github.com/apache/doris/actions/runs/4675966338";) output.
   
   <details>
   <summary>shellcheck errors</summary>
   
   ```
   
   'shellcheck ' returned error 1 finding the following syntactical issues:
   
   ----------
   
   In tools/get_query_profiles.sh line 30:
     case "$opt" in
     ^-- SC2220 (warning): Invalid flags are not handled. Add a *) case.
     ^-- SC2249 (info): Consider adding a default *) case, even if it just 
exits with error.
           ^--^ SC2250 (style): Prefer putting braces around variable 
references even when not strictly required.
   
   Did you mean: 
     case "${opt}" in
   
   
   In tools/get_query_profiles.sh line 32:
           QUERY_ID="$OPTARG"
                     ^-----^ SC2250 (style): Prefer putting braces around 
variable references even when not strictly required.
   
   Did you mean: 
           QUERY_ID="${OPTARG}"
   
   
   In tools/get_query_profiles.sh line 35:
           OUTPUT_DIR="$OPTARG"
                       ^-----^ SC2250 (style): Prefer putting braces around 
variable references even when not strictly required.
   
   Did you mean: 
           OUTPUT_DIR="${OPTARG}"
   
   
   In tools/get_query_profiles.sh line 40:
   if [ -z $QUERY_ID ]; then
      ^--------------^ SC2292 (style): Prefer [[ ]] over [ ] for tests in 
Bash/Ksh.
           ^-------^ 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: 
   if [[ -z "$QUERY_ID" ]]; then
   
   
   In tools/get_query_profiles.sh line 46:
   if [ -z $OUTPUT_DIR ]; then
      ^----------------^ SC2292 (style): Prefer [[ ]] over [ ] for tests in 
Bash/Ksh.
           ^---------^ 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: 
   if [[ -z "$OUTPUT_DIR" ]]; then
   
   
   In tools/get_query_profiles.sh line 52:
   echo "get profiles for query $QUERY_ID, output: $OUTPUT_DIR"
                                ^-------^ 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 "get profiles for query ${QUERY_ID}, output: ${OUTPUT_DIR}"
   
   
   In tools/get_query_profiles.sh line 60:
   mysql -h$FE_HOST -u$USER -P$FE_QUERY_PORT -e "${SHOW_QUERY_PROFILE} 
'/${QUERY_ID}'" | sed 's/\\n/\n/g' > ${PLAN_GRAPH_FILE}
           ^------^ 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.
                      ^---^ 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.
                              ^------------^ 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.
   
   Did you mean: 
   mysql -h"$FE_HOST" -u$USER -P$FE_QUERY_PORT -e "${SHOW_QUERY_PROFILE} 
'/${QUERY_ID}'" | sed 's/\\n/\n/g' > ${PLAN_GRAPH_FILE}
   
   
   In tools/get_query_profiles.sh line 62:
   cat ${PLAN_GRAPH_FILE} | grep "Fragment: " | sort | uniq >${FRAGS_FILE} 
       ^----------------^ SC2086 (info): Double quote to prevent globbing and 
word splitting.
                                                             ^-----------^ 
SC2086 (info): Double quote to prevent globbing and word splitting.
   
   Did you mean: 
   cat "${PLAN_GRAPH_FILE}" | grep "Fragment: " | sort | uniq >"${FRAGS_FILE}" 
   
   
   In tools/get_query_profiles.sh line 63:
   cat ${PLAN_GRAPH_FILE} | grep "Fragment: " | grep -o "[0-9]" | sort | uniq 
>${FRAG_IDS_FILE} 
       ^----------------^ SC2086 (info): Double quote to prevent globbing and 
word splitting.
                                                                               
^--------------^ SC2086 (info): Double quote to prevent globbing and word 
splitting.
   
   Did you mean: 
   cat "${PLAN_GRAPH_FILE}" | grep "Fragment: " | grep -o "[0-9]" | sort | uniq 
>"${FRAG_IDS_FILE}" 
   
   
   In tools/get_query_profiles.sh line 67:
   for frag_id in `cat ${FRAG_IDS_FILE}`
                  ^--------------------^ SC2013 (info): To read lines rather 
than words, pipe/redirect to a 'while read' loop.
                  ^--------------------^ SC2006 (style): Use $(...) notation 
instead of legacy backticks `...`.
                       ^--------------^ SC2086 (info): Double quote to prevent 
globbing and word splitting.
   
   Did you mean: 
   for frag_id in $(cat "${FRAG_IDS_FILE}")
   
   
   In tools/get_query_profiles.sh line 73:
       mysql -h$FE_HOST -u$USER -P$FE_QUERY_PORT -e "${sql}" | sed -n '2,$p' > 
${frag_inst_ids_outfile}
               ^------^ 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.
                          ^---^ 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.
                                  ^------------^ 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.
   
   Did you mean: 
       mysql -h"$FE_HOST" -u$USER -P$FE_QUERY_PORT -e "${sql}" | sed -n '2,$p' 
> ${frag_inst_ids_outfile}
   
   
   In tools/get_query_profiles.sh line 74:
       while read line
             ^--^ SC2162 (info): read without -r will mangle backslashes.
   
   
   In tools/get_query_profiles.sh line 76:
           frag_inst_id=`echo "$line" | cut -f1`
                        ^----------------------^ SC2006 (style): Use $(...) 
notation instead of legacy backticks `...`.
                               ^---^ SC2250 (style): Prefer putting braces 
around variable references even when not strictly required.
   
   Did you mean: 
           frag_inst_id=$(echo "${line}" | cut -f1)
   
   
   In tools/get_query_profiles.sh line 79:
           mysql -h$FE_HOST -u$USER -P$FE_QUERY_PORT -e "${sql}" | sed 
's/\\n/\n/g' > ${frag_inst_profile}
                   ^------^ 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.
                              ^---^ 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.
                                      ^------------^ 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.
   
   Did you mean: 
           mysql -h"$FE_HOST" -u$USER -P$FE_QUERY_PORT -e "${sql}" | sed 
's/\\n/\n/g' > ${frag_inst_profile}
   
   
   In tools/get_query_profiles.sh line 80:
       done < ${frag_inst_ids_outfile}
              ^----------------------^ SC2086 (info): Double quote to prevent 
globbing and word splitting.
   
   Did you mean: 
       done < "${frag_inst_ids_outfile}"
   
   For more information:
     https://www.shellcheck.net/wiki/SC2220 -- Invalid flags are not handled. 
Ad...
     https://www.shellcheck.net/wiki/SC2013 -- To read lines rather than words, 
...
     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/get_query_profiles.sh.orig
   +++ tools/get_query_profiles.sh
   @@ -27,14 +27,14 @@
    SHOW_QUERY_PROFILE="show query profile"
    
    while getopts ":q:o:" opt; do
   -  case "$opt" in
   -     q)
   +    case "$opt" in
   +    q)
            QUERY_ID="$OPTARG"
   -         ;;
   -     o)
   +        ;;
   +    o)
            OUTPUT_DIR="$OPTARG"
   -         ;;
   -   esac
   +        ;;
   +    esac
    done
    
    if [ -z $QUERY_ID ]; then
   @@ -57,25 +57,22 @@
    FRAGS_FILE=${OUTPUT_DIR}/${QUERY_ID}_frags
    FRAG_IDS_FILE=${OUTPUT_DIR}/${QUERY_ID}_frag_ids
    
   -mysql -h$FE_HOST -u$USER -P$FE_QUERY_PORT -e "${SHOW_QUERY_PROFILE} 
'/${QUERY_ID}'" | sed 's/\\n/\n/g' > ${PLAN_GRAPH_FILE}
   +mysql -h$FE_HOST -u$USER -P$FE_QUERY_PORT -e "${SHOW_QUERY_PROFILE} 
'/${QUERY_ID}'" | sed 's/\\n/\n/g' >${PLAN_GRAPH_FILE}
    
   -cat ${PLAN_GRAPH_FILE} | grep "Fragment: " | sort | uniq >${FRAGS_FILE} 
   -cat ${PLAN_GRAPH_FILE} | grep "Fragment: " | grep -o "[0-9]" | sort | uniq 
>${FRAG_IDS_FILE} 
   +cat ${PLAN_GRAPH_FILE} | grep "Fragment: " | sort | uniq >${FRAGS_FILE}
   +cat ${PLAN_GRAPH_FILE} | grep "Fragment: " | grep -o "[0-9]" | sort | uniq 
>${FRAG_IDS_FILE}
    
   -
    # frag inst ids
   -for frag_id in `cat ${FRAG_IDS_FILE}`
   -do
   +for frag_id in $(cat ${FRAG_IDS_FILE}); do
        sql="${SHOW_QUERY_PROFILE} '/${QUERY_ID}/${frag_id}'"
        frag_inst_ids_outfile="${OUTPUT_DIR}/frag_${frag_id}_instances"
   -    
   +
        echo "sql: ${sql}"
   -    mysql -h$FE_HOST -u$USER -P$FE_QUERY_PORT -e "${sql}" | sed -n '2,$p' > 
${frag_inst_ids_outfile}
   -    while read line
   -    do
   -        frag_inst_id=`echo "$line" | cut -f1`
   +    mysql -h$FE_HOST -u$USER -P$FE_QUERY_PORT -e "${sql}" | sed -n '2,$p' 
>${frag_inst_ids_outfile}
   +    while read line; do
   +        frag_inst_id=$(echo "$line" | cut -f1)
            frag_inst_profile="${OUTPUT_DIR}/frag_${frag_id}_${frag_inst_id}"
            sql="${SHOW_QUERY_PROFILE} 
'/${QUERY_ID}/${frag_id}/${frag_inst_id}'"
   -        mysql -h$FE_HOST -u$USER -P$FE_QUERY_PORT -e "${sql}" | sed 
's/\\n/\n/g' > ${frag_inst_profile}
   -    done < ${frag_inst_ids_outfile}
   +        mysql -h$FE_HOST -u$USER -P$FE_QUERY_PORT -e "${sql}" | sed 
's/\\n/\n/g' >${frag_inst_profile}
   +    done <${frag_inst_ids_outfile}
    done
   ----------
   
   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

Reply via email to