Skip to content

feat: analyze files several at once, each whatever the others came to - #148

Merged
skipbit merged 4 commits into
mainfrom
feat/parallel-analysis
Nov 23, 2026
Merged

skipbit merged 4 commits into
mainfrom
feat/parallel-analysis

Conversation

@skipbit

@skipbit skipbit commented Nov 23, 2026

Copy link
Copy Markdown
Owner

Summary

Adds the part that analyzes the files of a project several at once, which scrap check will use. No command uses it yet, and it knows nothing of clang-tidy: it is handed the function that analyzes one file.

  • Check::analyzeFiles takes the files in order and analyzes as many at once as it is told, with the calling thread as one of the threads, as the steps of a build are run.
  • A reporter is told of each file as it starts, and once it has ended with what the tool wrote, one call at a time, so what the files wrote comes in the order they ended.
  • Every file is analyzed whatever the others came to, since each stands alone; the files whose analysis failed come back, in the order they ended. Only a tool that cannot be started stops the analysis, as it would fail every file the same way: no file starts after it, and those already running are waited for.
  • What the analysis or the reporter throws stops it the same way and reaches the caller.

The steps of a build are not reused, as they wait for the kinds before their own, skip what is up to date, and stop at the first failure, none of which an analysis wants.

Tests

ParallelAnalysisTest, 6 tests, with a scripted analysis and a reporter that fails the test when two calls overlap: every file analyzed after one fails, files analyzed at the same time, output and failures in the order the files ended, the stop once the tool cannot be started, nothing to analyze, and what an analysis throws.

Each of these fails at least one test when taken out: going on after a failure, stopping once the tool cannot be started, the output handed to the reporter, more than one thread, analyzing outside the lock, and passing on or stopping at what was thrown.

Locally, the tests ran 500 times in a row, and 200 times built with GCC's ThreadSanitizer, with no failure and no report.

analyzeFiles hands the files to as many threads as it is told, and
tells a reporter of each file as it starts and once it has ended, one
call at a time. Unlike the steps of a build, a file that fails does not
stop the others; only a tool that cannot be started does.
The queue held the function given to it as _analyze, beside its own
analyze, which reports a file around it; a call to either read alike.
The parallel analysis tests wait on events alone, as the build tests
do, and rely on the time limit to end a wait that never ends.
@skipbit
skipbit merged commit bdc0da0 into main Nov 23, 2026
29 checks passed
@skipbit
skipbit deleted the feat/parallel-analysis branch November 23, 2026 06:33
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