Copilot commented on code in PR #460:
URL: https://github.com/apache/trafficserver-ci/pull/460#discussion_r3918587604


##########
jenkins/github/clang-analyzer.pipeline:
##########
@@ -109,23 +109,70 @@ pipeline {
                         set -x
                         set -e
 
-                        if [ -d cmake ]
+                        if [ ! -d cmake ]
+                        then
+                            echo "Clang-Tidy is not supported for this 
branch's autotools build."
+                        elif [ ! -f .clang-tidy-ci ]
                         then
-                            if [ -f .clang-tidy-ci ]
+                            echo "Clang-Tidy CI configuration is not available 
on this branch."
+                        else
+                            # The report directory is under output/ so that it 
is picked up by the
+                            # archiveArtifacts step, next to the 
clang-analyzer HTML report.
+                            
report_dir="${WORKSPACE}/output/${GITHUB_PR_NUMBER}/clang-tidy"
+                            mkdir -p "${report_dir}"
+
+                            # Jenkins checks out the ATS source tree in 
${WORKSPACE}/src.
+                            #
+                            # The full output is kept as an artifact. The 
console copy drops the
+                            # per-translation-unit "N warnings generated." 
lines, which otherwise
+                            # outnumber the diagnostics themselves by two 
orders of magnitude.
+                            # errexit is disabled around the pipeline so that 
the run-clang-tidy
+                            # status can be read out of PIPESTATUS rather than 
the status of the
+                            # filter at the end of the pipe.
+                            set +e
+                            run-clang-tidy \
+                                -j4 \
+                                -quiet \
+                                -p build \
+                                -config-file=.clang-tidy-ci \
+                                
-header-filter="^${WORKSPACE}/src/(include|src|plugins)/" \
+                                -export-fixes 
"${report_dir}/clang-tidy-fixes.yaml" \
+                                "${WORKSPACE}/src/(src|plugins)/.*" 2>&1 \
+                                | tee "${report_dir}/clang-tidy.log" \
+                                | grep -v -E "^[0-9]+ warnings generated"

Review Comment:
   The console filter only matches the plural form "N warnings generated". 
Clang also emits the singular form "1 warning generated.", which will still 
clutter the console output and defeat the goal of suppressing 
per-translation-unit counts.



##########
jenkins/github/clang-analyzer.pipeline:
##########
@@ -109,23 +109,70 @@ pipeline {
                         set -x
                         set -e
 
-                        if [ -d cmake ]
+                        if [ ! -d cmake ]
+                        then
+                            echo "Clang-Tidy is not supported for this 
branch's autotools build."
+                        elif [ ! -f .clang-tidy-ci ]
                         then
-                            if [ -f .clang-tidy-ci ]
+                            echo "Clang-Tidy CI configuration is not available 
on this branch."
+                        else
+                            # The report directory is under output/ so that it 
is picked up by the
+                            # archiveArtifacts step, next to the 
clang-analyzer HTML report.
+                            
report_dir="${WORKSPACE}/output/${GITHUB_PR_NUMBER}/clang-tidy"
+                            mkdir -p "${report_dir}"
+
+                            # Jenkins checks out the ATS source tree in 
${WORKSPACE}/src.
+                            #
+                            # The full output is kept as an artifact. The 
console copy drops the
+                            # per-translation-unit "N warnings generated." 
lines, which otherwise
+                            # outnumber the diagnostics themselves by two 
orders of magnitude.
+                            # errexit is disabled around the pipeline so that 
the run-clang-tidy
+                            # status can be read out of PIPESTATUS rather than 
the status of the
+                            # filter at the end of the pipe.
+                            set +e
+                            run-clang-tidy \
+                                -j4 \
+                                -quiet \
+                                -p build \
+                                -config-file=.clang-tidy-ci \
+                                
-header-filter="^${WORKSPACE}/src/(include|src|plugins)/" \
+                                -export-fixes 
"${report_dir}/clang-tidy-fixes.yaml" \
+                                "${WORKSPACE}/src/(src|plugins)/.*" 2>&1 \
+                                | tee "${report_dir}/clang-tidy.log" \
+                                | grep -v -E "^[0-9]+ warnings generated"
+                            tidy_status=${PIPESTATUS[0]}
+                            set -e
+
+                            # Collect the diagnostics themselves so that they 
are readable at the
+                            # end of the console log instead of buried in the 
middle of a run over
+                            # several hundred translation units.
+                            grep -h -E ":[0-9]+:[0-9]+: (warning|error):" 
"${report_dir}/clang-tidy.log" \

Review Comment:
   The diagnostic summary regex does not match clang's "fatal error:" 
diagnostics (e.g. missing headers). If clang-tidy fails primarily due to fatal 
errors, the end-of-log summary may incorrectly report "No diagnostics reported."



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to