style: format sources and normalize comment conventions#104
Conversation
- Apply clang-format 18 across tracked C++ sources (no behavior change). - Move trailing ///< member docs above the member; convert multi-line /// to /** */. - Remove two write-only dead members (StringPool m_pool_size, Block slot_count). - Fix four inaccurate comments (logger localtime_s, profiler overflow bound, bootstrap, platform). - Un-wrap markdown docs (no hard 80-col wrap); codify comment and formatting rules in AGENTS.md. - Add scripts/check_comment_style.py plus an advisory CI lint step. - Point IntelliSense (c_cpp_properties.json) at the build's compile_commands.
📝 WalkthroughWalkthroughThis PR is a comprehensive code formatting and documentation standardization pass. It introduces a new comment-style linter tool ( ChangesFormatting and Documentation Standardization
🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly Related PRs
|
There was a problem hiding this comment.
🧹 Nitpick comments (3)
scripts/check_comment_style.py (2)
32-32: 💤 Low valueStatic analysis hint (S607) is a false positive in this context.
The Ruff warning about using a partial executable path (
git) is technically correct for general security hardening, but it's a false positive here. The script runs in trusted CI and developer environments wheregitis a required dependency and the PATH is controlled. Hardcoding a full path would reduce portability across platforms without meaningful security benefit in this context.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/check_comment_style.py` at line 32, The Ruff S607 warning is a false positive for using "git" via subprocess.check_output in this trusted script; suppress it by adding an inline noqa to the call so the linter ignores this case. Edit the line assigning files (the subprocess.check_output(["git", "ls-files", "*.cpp", "*.hpp"], text=True).split()) and append a comment like "# noqa: S607" to that statement to silence the warning while keeping portability and behavior unchanged.Source: Linters/SAST tools
36-36: 💤 Low valueConsider
splitlines()for more robust line-ending handling.Using
splitlines()instead ofsplit("\n")would handle different line-ending conventions (\r\n,\r,\n) more uniformly and is the idiomatic Python approach for splitting text into lines.📝 Optional refinement
- lines = handle.read().split("\n") + lines = handle.read().splitlines()🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/check_comment_style.py` at line 36, Replace the fragile handle.read().split("\n") call with Python's line-splitting API: use handle.read().splitlines() (or str.splitlines(keepends=True) if you intentionally need to preserve newline characters) so the parsing in the lines variable correctly handles CR, LF and CRLF line endings; update the use sites that rely on lines accordingly (refer to the handle.read().split("\n") occurrence and the lines variable in scripts/check_comment_style.py)..vscode/c_cpp_properties.json (1)
3-35: ⚡ Quick winConsider adding a MinGW configuration for dual-toolchain development.
The configuration now exclusively targets MSVC via
cl.exeand themsvc-debugbuild directory. Since the project supports both MSVC and MinGW builds (per learnings), developers working with MinGW would need to manually switch configurations.Adding a second configuration entry for MinGW would improve the developer experience for those using both toolchains.
🔧 Example MinGW configuration addition
{ "configurations": [ { "name": "windows-msvc-x64", "compileCommands": "${workspaceFolder}/build/msvc-debug/compile_commands.json", ... }, { "name": "windows-mingw-x64", "compileCommands": "${workspaceFolder}/build/mingw-debug/compile_commands.json", "includePath": [ "${workspaceFolder}/include", "${workspaceFolder}/src", "${workspaceFolder}/external/DirectXMath/Inc", "${workspaceFolder}/external/simpleini", "${workspaceFolder}/external/safetyhook/include", "${workspaceFolder}/build/mingw-debug/generated", "${workspaceFolder}/build/mingw-debug/_deps/zydis-src/include", "${workspaceFolder}/build/mingw-debug/_deps/zydis-build", "${workspaceFolder}/build/mingw-debug/_deps/zydis-src/dependencies/zycore/include", "${workspaceFolder}/build/mingw-debug/_deps/zydis-build/zycore" ], "defines": [ "_DEBUG", "UNICODE", "_UNICODE", "WIN32", "_WINDOWS", "NOMINMAX", "SAFETYHOOK_NO_DLL", "WINVER=0x0A00", "_WIN32_WINNT=0x0A00", "ZYCORE_STATIC_BUILD", "ZYDIS_STATIC_BUILD" ], "compilerPath": "g++.exe", "cStandard": "c23", "cppStandard": "c++23", "intelliSenseMode": "windows-gcc-x64" } ], "version": 4 }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.vscode/c_cpp_properties.json around lines 3 - 35, The current c_cpp_properties.json only defines the MSVC config ("name": "windows-msvc-x64", "compilerPath": "cl.exe") so add a second configuration object for MinGW (e.g., "name": "windows-mingw-x64") inside a top-level "configurations" array: set "compileCommands" to the mingw build's compile_commands.json, mirror the MSVC "includePath" and "defines" but replace MSVC-specific build folders with the mingw equivalents (e.g., build/mingw-debug/generated, build/mingw-debug/_deps/...), set "compilerPath" to "g++.exe" and "intelliSenseMode" to "windows-gcc-x64", and ensure the file ends with the "version": 4 field.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In @.vscode/c_cpp_properties.json:
- Around line 3-35: The current c_cpp_properties.json only defines the MSVC
config ("name": "windows-msvc-x64", "compilerPath": "cl.exe") so add a second
configuration object for MinGW (e.g., "name": "windows-mingw-x64") inside a
top-level "configurations" array: set "compileCommands" to the mingw build's
compile_commands.json, mirror the MSVC "includePath" and "defines" but replace
MSVC-specific build folders with the mingw equivalents (e.g.,
build/mingw-debug/generated, build/mingw-debug/_deps/...), set "compilerPath" to
"g++.exe" and "intelliSenseMode" to "windows-gcc-x64", and ensure the file ends
with the "version": 4 field.
In `@scripts/check_comment_style.py`:
- Line 32: The Ruff S607 warning is a false positive for using "git" via
subprocess.check_output in this trusted script; suppress it by adding an inline
noqa to the call so the linter ignores this case. Edit the line assigning files
(the subprocess.check_output(["git", "ls-files", "*.cpp", "*.hpp"],
text=True).split()) and append a comment like "# noqa: S607" to that statement
to silence the warning while keeping portability and behavior unchanged.
- Line 36: Replace the fragile handle.read().split("\n") call with Python's
line-splitting API: use handle.read().splitlines() (or
str.splitlines(keepends=True) if you intentionally need to preserve newline
characters) so the parsing in the lines variable correctly handles CR, LF and
CRLF line endings; update the use sites that rely on lines accordingly (refer to
the handle.read().split("\n") occurrence and the lines variable in
scripts/check_comment_style.py).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5a99320b-ab72-4883-9178-9401d5b3f9c5
📒 Files selected for processing (62)
.github/workflows/quality.yml.gitignore.vscode/c_cpp_properties.jsonAGENTS.mdREADME.mddocs/analysis/event_dispatcher_bench_v3.1.0/README.mddocs/hot-reload/README.mddocs/misc/asan-memory-scanner.mddocs/misc/hot-path-memory.mddocs/tests/README.mddocs/tests/test_compile.cppinclude/DetourModKit/anchors.hppinclude/DetourModKit/async_logger.hppinclude/DetourModKit/bootstrap.hppinclude/DetourModKit/config.hppinclude/DetourModKit/diagnostics.hppinclude/DetourModKit/drift_manifest.hppinclude/DetourModKit/event_dispatcher.hppinclude/DetourModKit/hook_manager.hppinclude/DetourModKit/input.hppinclude/DetourModKit/input_codes.hppinclude/DetourModKit/logger.hppinclude/DetourModKit/memory.hppinclude/DetourModKit/profiler.hppinclude/DetourModKit/rtti_dissect.hppinclude/DetourModKit/scanner.hppscripts/check_comment_style.pysrc/async_logger.cppsrc/config.cppsrc/config_watcher.cppsrc/input.cppsrc/input_intercept.cppsrc/input_intercept.hppsrc/logger.cppsrc/memory.cppsrc/platform.hppsrc/profiler.cppsrc/rtti.cppsrc/rtti_internal.hppsrc/scanner_cascade.cppsrc/scanner_internal.hppsrc/string_xref.cppsrc/win_file_stream.cppsrc/worker.cpptests/bench_event_dispatcher.cpptests/bench_memory.cpptests/bench_scanner.cpptests/test_async_logger.cpptests/test_bootstrap.cpptests/test_code_constant.cpptests/test_config.cpptests/test_event_dispatcher.cpptests/test_hook_manager.cpptests/test_input.cpptests/test_input_intercept.cpptests/test_logger.cpptests/test_memory_chain.cpptests/test_profiler.cpptests/test_rtti.cpptests/test_rtti_dissect.cpptests/test_rtti_reverse.cpptests/test_scanner.cpp
💤 Files with no reviewable changes (2)
- tests/test_async_logger.cpp
- src/scanner_cascade.cpp
Summary
Repo-wide formatting and comment-convention cleanup with supporting tooling. No library behavior changes: the build stays -Werror clean and the full test suite stays green (1389/1389).
Highlights:
Summary by CodeRabbit
Release Notes
New Features
Documentation
Chores