Skip to content

Commit ab76e3b

Browse files
committed
build: write output to files
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na ---
1 parent 64022cb commit ab76e3b

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

.github/workflows/lint_random_files.yml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -369,40 +369,42 @@ jobs:
369369
# Define the path to cppcheck configuration file for linting benchmarks:
370370
cppcheck_benchmarks_suppressions_list="${root}/etc/cppcheck/suppressions.benchmarks.txt"
371371
372-
# Initialize a variable to capture errors:
373-
err_output=""
372+
# Define output files for each category:
373+
out_source="lint_c_errors_source.txt"
374+
out_examples="lint_c_errors_examples.txt"
375+
out_tests="lint_c_errors_tests.txt"
376+
out_benchmarks="lint_c_errors_benchmarks.txt"
377+
combined="lint_c_errors.txt"
374378
375379
# Lint C source files:
376380
files=$(echo "${{ steps.random-files.outputs.files }}" | tr ',' '\n' | grep -E '\.c$' | grep -v -e '/examples' -e '/test' -e '/benchmark' | tr '\n' ' ')
377381
if [[ -n "${files}" ]]; then
378-
err_output+=$(make lint-c-files FILES="${files}" 2>&1)
382+
make lint-c-files FILES="${files}" CPPCHECK_FLAGS="--output-file=${out_source}"
379383
fi
380384
381385
# Lint C example files...
382386
files=$(echo "${{ steps.random-files.outputs.files }}" | tr ',' '\n' | grep '/examples/.*\.c$' | tr '\n' ' ')
383387
if [[ -n "${files}" ]]; then
384-
err_output+=$(make lint-c-files FILES="${files}" CPPCHECK_SUPPRESSIONS_LIST="${cppcheck_examples_suppressions_list}" 2>&1)
388+
make lint-c-files FILES="${files}" CPPCHECK_FLAGS="--output-file=${out_examples}" CPPCHECK_SUPPRESSIONS_LIST="${cppcheck_examples_suppressions_list}"
385389
fi
386390
387391
# Lint C test fixtures files...
388392
files=$(echo "${{ steps.random-files.outputs.files }}" | tr ',' '\n' | grep '/test/fixtures/.*\.c$' | tr '\n' ' ')
389393
if [[ -n "${files}" ]]; then
390-
err_output+=$(make lint-c-files FILES="${files}" CPPCHECK_SUPPRESSIONS_LIST="${cppcheck_tests_fixtures_suppressions_list}" 2>&1)
394+
make lint-c-files FILES="${files}" CPPCHECK_FLAGS="--output-file=${out_tests}" CPPCHECK_SUPPRESSIONS_LIST="${cppcheck_tests_fixtures_suppressions_list}"
391395
fi
392396
393397
# Lint C benchmark files...
394398
files=$(echo "${{ steps.random-files.outputs.files }}" | tr ',' '\n' | grep '/benchmark/.*\.c$' | tr '\n' ' ')
395399
if [[ -n "${files}" ]]; then
396-
err_output+=$(make lint-c-files FILES="${files}" CPPCHECK_SUPPRESSIONS_LIST="${cppcheck_benchmarks_suppressions_list}" 2>&1)
400+
make lint-c-files FILES="${files}" CPPCHECK_FLAGS="--output-file=${out_benchmarks}" CPPCHECK_SUPPRESSIONS_LIST="${cppcheck_benchmarks_suppressions_list}"
397401
fi
398402
399-
# Print the errors to the log:
400-
echo "$err_output"
403+
# Combine all outputs into one file:
404+
cat "$out_source" "$out_examples" "$out_tests" "$out_benchmarks" > "$combined"
401405
402-
# Save the captured errors as an output variable...
403-
echo "stderr<<EOF" >> $GITHUB_OUTPUT
404-
echo "$err_output" >> $GITHUB_OUTPUT
405-
echo "EOF" >> $GITHUB_OUTPUT
406+
# Print the combined errors to the log:
407+
cat "$combined"
406408
407409
# Create sub-issue for C linting failures:
408410
- name: 'Create sub-issue for C lint failures'
@@ -426,7 +428,7 @@ jobs:
426428
### Error Details
427429
428430
\`\`\`
429-
$(grep -B 1 -A 2 "style:\|warning:\|error:" <<< "${{ steps.lint-c.outputs.stderr }}")
431+
$(grep -B 1 -A 2 "style:\|warning:\|error:" "lint_c_errors.txt")
430432
\`\`\`
431433
EOF
432434

0 commit comments

Comments
 (0)