Skip to content

Conversation

@tenpercent
Copy link
Contributor

@tenpercent tenpercent commented Jan 16, 2026

Summary

This PR optimizes the Jenkins CI clang-format check to be faster and remove the git dependency.

Changes

  • Use find instead of git ls-files - No git dependency required in build environment
  • Check all C++ files: *.h, *.hpp, *.cpp, *.h.in, *.hpp.in, *.cpp.in, *.cl
  • Exclude directories: build/ and include/rapidjson (same as before)
  • Parallel processing: Use 8 cores (-P 8) instead of sequential processing
  • Cleaner output: Show only errors with unified diff format (-u)
  • Better error messages: "ERROR: needs formatting"
  • Preserve original logic:
    • When RUN_CPPCHECK=false: Run clang-format only
    • When RUN_CPPCHECK=true: Run both clang-format and cppcheck

Performance

Measured on 5,899 C++ files:

  • Sequential processing (-P 1): ~93 seconds
  • Parallel with 8 cores (-P 8): ~12 seconds
  • Speedup: 7.9x faster
  • Per-file processing: ~15ms

Benefits

  • 8x faster clang-format checks (~81 seconds saved)
  • No git dependency - works in any build environment
  • Same file coverage - all C++ files are still checked
  • Cleaner CI output - only shows errors, not every file processed
  • Better error reporting - unified diff format shows exactly what needs fixing

Test Plan

  • Verify clang-format runs successfully on all files
  • Verify both RUN_CPPCHECK=true and RUN_CPPCHECK=false scenarios work
  • Confirm formatting errors are properly detected and reported
  • Validate parallel processing completes correctly

@tenpercent tenpercent changed the title Remove clang-format invocations from Jenkinsfile Run clang-format only on C++ files changed in branch Jan 16, 2026
@tenpercent tenpercent force-pushed the tenpercent/remove-clang-format-jenkinsfile branch from 3c3f007 to 1a7fbcd Compare January 16, 2026 21:03
This change improves the clang-format CI check to be faster and not
depend on git being available in the build environment.

Changes:
- Use `find` instead of `git ls-files` (no git dependency)
- Check all C++ files: *.h, *.hpp, *.cpp, *.h.in, *.hpp.in, *.cpp.in, *.cl
- Exclude build/ and include/rapidjson directories
- Use parallel processing with 8 cores (-P 8) for ~8x speedup
- Show only errors with unified diff format (-u)
- Clear error messages: "ERROR: <file> needs formatting"
- Preserve original logic: run clang-format only when RUN_CPPCHECK=false,
  or run both clang-format and cppcheck when RUN_CPPCHECK=true

Performance:
- Sequential processing: ~93 seconds for 5,899 files
- Parallel with 8 cores: ~12 seconds for 5,899 files
- Per-file processing time: ~15ms

This reduces CI time while maintaining code formatting standards.
@tenpercent tenpercent force-pushed the tenpercent/remove-clang-format-jenkinsfile branch from 1a7fbcd to 8c101c2 Compare January 19, 2026 18:53
@tenpercent tenpercent changed the title Run clang-format only on C++ files changed in branch Optimize clang-format check in Jenkins CI Jan 19, 2026
@illsilin illsilin merged commit 98abfa4 into develop Jan 19, 2026
7 checks passed
@illsilin illsilin deleted the tenpercent/remove-clang-format-jenkinsfile branch January 19, 2026 20:23
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.

3 participants