Skip to content

Conversation

@JohnsterID
Copy link

Draft script for clang-tidy.

…ysis

- Add comprehensive .clang-tidy configuration tailored for legacy C++98/C++20 hybrid codebase
- Add Python helper script for running clang-tidy with project-specific filtering
- Update TESTING.md with clang-tidy usage documentation and examples
- Support MinGW-w64 cross-compilation environment and ReactOS ATL compatibility
- CMAKE_EXPORT_COMPILE_COMMANDS already enabled in existing presets
Add Windows Command Prompt and PowerShell alternatives to the existing
Unix/Linux find command for running clang-tidy on multiple files.
The Python helper script already supports all platforms.
@JohnsterID JohnsterID marked this pull request as ready for review October 4, 2025 07:22
@xezon xezon added the Build Anything related to building, compiling label Oct 16, 2025
@xezon xezon requested a review from OmniBlade October 16, 2025 07:59
Copy link

@OmniBlade OmniBlade left a comment

Choose a reason for hiding this comment

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

I get nothing but errors when I point it at a successful build directory of the following kind when I run your powershell. Your python only works for small sets of files on windows and generates errors in a similar manner though they are hidden from view:

error: PCH file 'C:/Code/CnC_Generals_Zero_Hour/build/custom/Generals/Code/GameEngine/CMakeFiles/g_gameengine.dir/Debug/cmake_pch.cxx.pch' not found: module file not found [clang-diagnostic-error]


def find_project_root() -> Path:
"""Find the project root directory by looking for CMakeLists.txt."""
current = Path(__file__).parent

Choose a reason for hiding this comment

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

My testing has failed here where the path passed to python is relative. Changing this line to current = Path(__file__).parent.resolve() to ensure its working on the fully qualified path solved this for me.

# For now, run sequentially
print(f"Note: Parallel execution with {jobs} jobs not implemented yet.")

result = subprocess.run(cmd, cwd=find_project_root())

Choose a reason for hiding this comment

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

This fails to run on windows for me for the whole set of files, I suspect the command line it generates is too long for cmd to handle, though it also fails in gitbash.

HeaderFilterRegex: '(Core|Generals|GeneralsMD|Dependencies)/.*\.(h|hpp)$'

# Analysis options
AnalyzeTemporaryDtors: false

Choose a reason for hiding this comment

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

LLVM 19 I have installed locally does not like this option, I suspect older versions from stable Linux OS distributions will like it even less?

@JohnsterID
Copy link
Author

Replaced by #1807. Thanks.

@JohnsterID JohnsterID closed this Nov 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Build Anything related to building, compiling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants