Skip to content

Comments

#11: Add automated testing and static analysis#12

Closed
oltir06 wants to merge 7 commits intodevfrom
feature/11-automated-testing-linting
Closed

#11: Add automated testing and static analysis#12
oltir06 wants to merge 7 commits intodevfrom
feature/11-automated-testing-linting

Conversation

@oltir06
Copy link
Collaborator

@oltir06 oltir06 commented Feb 20, 2026

Resolves #11

Changes:

  • Added .clang-format based on LLVM C++17 style.
  • Added .clang-tidy configuration.
  • Updated build.yml CI workflow:
    • Added ctest step to Windows, macOS, and Linux builds.
    • Added new static-analysis job (clang-format and clang-tidy).

@oltir06 oltir06 requested review from MomdAli and Copilot February 20, 2026 21:01
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds the foundational infrastructure for automated testing and static analysis to the Voltray Engine CI/CD pipeline, addressing issue #11. It establishes quality gates for code formatting and static analysis, and prepares the project for future unit test integration.

Changes:

  • Added CTest framework support to CMakeLists.txt for future unit testing
  • Integrated ctest execution into all platform build jobs (Windows, macOS, Linux)
  • Created new static-analysis job with clang-format and clang-tidy checks
  • Added .clang-tidy configuration with naming conventions and code quality checks
  • Added .clang-format configuration based on LLVM style with project-specific rules

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.

File Description
CMakeLists.txt Added enable_testing() to prepare for future unit test integration
.github/workflows/build.yml Added ctest steps to all build jobs and created new static-analysis job for code quality checks
.clang-tidy Configured static analyzer with bugprone, readability, and modernize checks, plus naming convention enforcement
.clang-format Configured code formatter with LLVM base style, 4-space indents, 120-char line limit, and K&R brace style

Comment on lines 160 to 167
find . \( -name "*.h" -o -name "*.cpp" \) -not -path "./Vendor/*" -not -path "./build/*" | xargs clang-format --dry-run -Werror

- name: Configure CMake for Static Analysis
run: cmake -B ${{ env.BUILD_DIR }} -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON

- name: Run Static Analysis (clang-tidy)
run: |
find . \( -name "*.h" -o -name "*.cpp" \) -not -path "./Vendor/*" -not -path "./build/*" | xargs clang-tidy -p ${{ env.BUILD_DIR }}
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

The find command with xargs can fail if no files are found, causing the pipeline to fail unexpectedly. Consider using 'find ... -print0 | xargs -0' for safer handling of filenames with spaces, or add '-r' flag to xargs to handle empty input gracefully. Alternatively, check if files exist before running xargs. Example: 'find . ( -name ".h" -o -name ".cpp" ) -not -path "./Vendor/" -not -path "./build/" -print0 | xargs -0 -r clang-format --dry-run -Werror'

Suggested change
find . \( -name "*.h" -o -name "*.cpp" \) -not -path "./Vendor/*" -not -path "./build/*" | xargs clang-format --dry-run -Werror
- name: Configure CMake for Static Analysis
run: cmake -B ${{ env.BUILD_DIR }} -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- name: Run Static Analysis (clang-tidy)
run: |
find . \( -name "*.h" -o -name "*.cpp" \) -not -path "./Vendor/*" -not -path "./build/*" | xargs clang-tidy -p ${{ env.BUILD_DIR }}
find . \( -name "*.h" -o -name "*.cpp" \) -not -path "./Vendor/*" -not -path "./build/*" -print0 | xargs -0 -r clang-format --dry-run -Werror
- name: Configure CMake for Static Analysis
run: cmake -B ${{ env.BUILD_DIR }} -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- name: Run Static Analysis (clang-tidy)
run: |
find . \( -name "*.h" -o -name "*.cpp" \) -not -path "./Vendor/*" -not -path "./build/*" -print0 | xargs -0 -r clang-tidy -p ${{ env.BUILD_DIR }}

Copilot uses AI. Check for mistakes.
Comment on lines +28 to +29
- key: readability-identifier-naming.MemberCase
value: camelBack
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

The MemberCase configuration is incorrect according to the Voltray coding style guide. Member variables should use the m_ prefix followed by PascalCase (e.g., m_ViewMatrix, m_Position), not camelBack (e.g., m_viewMatrix, m_position). Change the value from 'camelBack' to 'PascalCase' to match the coding standard where member variables are named like m_Name, m_Objects, m_IsInitialized.

Copilot generated this review using guidance from repository custom instructions.
Comment on lines +22 to +23
- key: readability-identifier-naming.VariableCase
value: camelBack
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

The VariableCase configuration is incorrect. According to the Voltray coding style guide, regular variables should use camelCase (starting with lowercase), not camelBack. While these are similar, the correct clang-tidy value for this pattern is 'camelCase', not 'camelBack'.

Copilot generated this review using guidance from repository custom instructions.
PointerAlignment: Left

# Braces
BreakBeforeBraces: Attach
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

The BreakBeforeBraces setting is configured as 'Attach' (K&R style), but according to the Voltray coding style guide, the codebase should use Allman style for classes, functions, and namespaces (opening brace on a new line), while using K&R style only for control structures. However, examining the actual codebase (e.g., BaseCamera.h:38-39, SceneObject.h:22-23, Vec3.cpp functions), the code consistently uses K&R style (Attach) for both classes and functions throughout. This configuration matches the actual codebase practice, which differs from the documented style guide. Consider either updating the style guide document to match the actual practice, or changing this setting to Custom with specific rules for Allman style on classes/functions if you want to enforce the documented standard.

Copilot generated this review using guidance from repository custom instructions.
oltir06 and others added 4 commits February 20, 2026 22:10
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@oltir06 oltir06 closed this Feb 20, 2026
@oltir06 oltir06 deleted the feature/11-automated-testing-linting branch February 20, 2026 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant