Skip to content

Add static code analysis build targets and CI workflow#32

Merged
Nidrax merged 1 commit intotrunkfrom
copilot/add-static-code-analysis-targets
Feb 7, 2026
Merged

Add static code analysis build targets and CI workflow#32
Nidrax merged 1 commit intotrunkfrom
copilot/add-static-code-analysis-targets

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 6, 2026

Adds CMake targets and GitHub Actions workflow for automated static code analysis.

Changes

CMakeLists.txt

  • Added three analysis targets: cppcheck, clang-tidy, gcc-analyzer
  • Targets auto-detect tool availability and skip gracefully if missing
  • gcc-analyzer target builds with GCC -fanalyzer flag in separate build directory
  • Status messages follow consistent format across all three analysis targets (tool/compiler found with path, or not found with target availability notice)

GitHub Actions Workflow

  • Three parallel jobs (cppcheck, clang-tidy, gcc-analyzer) run on push/PR to trunk
  • Each job uses continue-on-error: true to surface all issues without blocking
  • Explicit contents: read permissions set per job
  • Uses Unix Makefiles generator (default) instead of Ninja to avoid build issues with generated XML header files

Documentation

  • Added static analysis section to INSTALL.md at the end of the file, after the Installing section
  • Includes usage examples and installation commands for all platforms
  • Updated table of contents to reflect the new section placement

Usage

cd build
cmake ..

# Run individual analysis targets
cmake --build . --target cppcheck
cmake --build . --target clang-tidy
cmake --build . --target gcc-analyzer

No dependencies added. Analysis tools are optional and detected at configure time. Analysis results are displayed in the build output logs.

PERFORM_CA
NO_SW_CHANGE

Copilot AI changed the title [WIP] Add build targets for static code analysis using cppcheck, clang, and gcc Add static code analysis build targets and CI workflow Feb 6, 2026
Copilot AI requested a review from Nidrax February 6, 2026 22:52
@Nidrax Nidrax marked this pull request as ready for review February 6, 2026 23:20
run: git submodule update --init --recursive

- name: Configure CMake
run: mkdir build && cd build && cmake -G Ninja -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ninja pipeline generates files with includes of some *.xml.h files that apparently are not found during build targeting clang-tidy causing compilation errors. Either use -G "Unix Makefiles" or skip the -G option entirely.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 1589797. Removed -G Ninja and switched to the default Unix Makefiles generator to avoid the *.xml.h include issues.

run: git submodule update --init --recursive

- name: Configure CMake
run: mkdir build && cd build && cmake -G Ninja -DCMAKE_BUILD_TYPE=$BUILD_TYPE ..
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The gcc workflow fails with the following output:

43m 38s
Run cd build && cmake --build . --target gcc-analyzer
ninja: build stopped: interrupted by user.
Error: Process completed with exit code 143.

https://github.com/veritaware/Besprited/actions/runs/21769371294/job/62813407431?pr=32

I'd suggest also dropping the use of ninja here

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 1589797. Removed Ninja generator from the gcc-analyzer job to resolve the build timeout/interruption issue.

run: git submodule update --init --recursive

- name: Configure CMake
run: mkdir build && cd build && cmake -G Ninja -DCMAKE_BUILD_TYPE=$BUILD_TYPE ..
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ninja pipeline generates files with includes of some *.xml.h files that apparently are not found during build targeting cppcheck causing compilation errors. Either use -G "Unix Makefiles" or skip the -G option entirely.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 1589797. Removed -G Ninja and switched to the default Unix Makefiles generator to avoid the *.xml.h include issues.

- Added CMake custom targets for cppcheck, clang-tidy, and gcc-analyzer
- Created GitHub Actions workflow for running static code analysis
- Each analysis tool runs in a separate job with continue-on-error
- Tools automatically detect if they're available on the system

Add documentation for static code analysis targets

- Added comprehensive documentation to INSTALL.md
- Documented all three analysis targets (cppcheck, clang-tidy, gcc-analyzer)
- Included installation instructions for analysis tools on all platforms
- Updated table of contents

PERFORM_CA
NO_SW_CHANGE
@Nidrax Nidrax force-pushed the copilot/add-static-code-analysis-targets branch from f3c171f to 0789c96 Compare February 7, 2026 03:27
@Nidrax Nidrax added the 💩code-quality This is related to code quality label Feb 7, 2026
@Nidrax Nidrax merged commit 4530aee into trunk Feb 7, 2026
7 of 8 checks passed
@Nidrax Nidrax deleted the copilot/add-static-code-analysis-targets branch February 7, 2026 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💩code-quality This is related to code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants