Description
This project ccccc is very attractive as a way to get extended metrics from a C++ codebase. However, ccccc lacks several key features including:
- Processing translation units in parallel
- Processing only a subset of files in the project
- Filtering output based on source location
- Line filtering
- etc.
But clang-tidy and run-clang-tidy.py supports all of that.
The idea here is to run ccccc as a specialized clang-tidy check so we can use all of the clang-tidy infrastructure. Here is a ChatGPT 5.5 Pro conversation about this:
Minimally Invasive Proposal
Define a new metrics-ccccc clang-tidy check without any modifications to clang-tidy or run-clang-tidy.py:
- Define a new
metrics-ccccc clang-tidy check that prints JSON output (or just writes a JSONL file) of the metrics given in the current ccccc repo in addition to those produced by readability-function-size and readability-function-cognitive-complexity.
- Build the new
metrics-ccccc clang-tidy check and run it with clang-tidy as a plug-in.
- Use run-clang-tidy.py with just the
metrics-ccccc check plugin and scrap the JSON output (or just let it write the the shared JSONL file)
- Implement your own deduplication of metrics in the JSON/JSONL output (which is what I am already doing in https://github.com/bartlettroscoe/cass-clang-metrics).
Here are the details on the implementation of this:
Here is how this would work with clangd to lookup additional information it has so that metrics-ccccc would not have to duplicate that:
More Invasive proposal
Extend clang-tidy and run-clang-tidy.py as follows:
- Define a structured JSON output system for special clang-tidy checks, as an alternative to text-based human-readable output
- Refactor the existing
readability-function-size and readability-function-cognitive-complexity checks to expose code that computes these metrics
- Define a new
metrics-ccccc clang-tidy check with JSON output that provides all of the metrics given in the current ccccc repo in addition to those produced by readability-function-size and readability-function-cognitive-complexity.
Description
This project ccccc is very attractive as a way to get extended metrics from a C++ codebase. However, ccccc lacks several key features including:
But clang-tidy and run-clang-tidy.py supports all of that.
The idea here is to run
cccccas a specialized clang-tidy check so we can use all of the clang-tidy infrastructure. Here is a ChatGPT 5.5 Pro conversation about this:Minimally Invasive Proposal
Define a new
metrics-cccccclang-tidy check without any modifications to clang-tidy or run-clang-tidy.py:metrics-cccccclang-tidy check that prints JSON output (or just writes a JSONL file) of the metrics given in the current ccccc repo in addition to those produced byreadability-function-sizeandreadability-function-cognitive-complexity.metrics-cccccclang-tidy check and run it with clang-tidy as a plug-in.metrics-ccccccheck plugin and scrap the JSON output (or just let it write the the shared JSONL file)Here are the details on the implementation of this:
Here is how this would work with clangd to lookup additional information it has so that
metrics-cccccwould not have to duplicate that:More Invasive proposal
Extend clang-tidy and run-clang-tidy.py as follows:
readability-function-sizeandreadability-function-cognitive-complexitychecks to expose code that computes these metricsmetrics-cccccclang-tidy check with JSON output that provides all of the metrics given in the current ccccc repo in addition to those produced byreadability-function-sizeandreadability-function-cognitive-complexity.