Repository navigation
feat: add scrap check, which analyzes the sources with clang-tidy - #149
Merged
Merged
Conversation
The width the verb is written in moves out of the build progress, so a check lines its own lines up with those of a build.
Each file is named as its analysis starts, and what the tool wrote follows once it has ended. The files the tool failed on are named after them with one hint, a tool that could not be started only once.
The commands scrap build would compile the project with are written to compile_commands.json, and the sources the paths name are analyzed with the clang-tidy on PATH, several at once, without compiling. --release analyzes with the commands of the release profile, and -j sets how many files are analyzed at once. A named file that is not a source of a target, a header among them, is left out with a warning.
With nothing written above it, the line naming the file gave no reason for the failure; it now says the status the tool exited with, as a format does.
Escaping the output of a tool for the terminal and asking whether standard error is one move out of the build progress, and both reporters write a tool's output through the same function, so a check no longer reads the build progress for it.
Format and check both selected the files the paths name and warned of what they left out; one function does it for both.
A check names the files it failed on without what the tool wrote, which it has shown already, so the heading with the signal or the status is offered apart from the output.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
scrap check [<path>...] [--release] [-j <jobs>]analyzes the sources of a project with theclang-tidyfound onPATH, with the commandsscrap buildwould compile them with, and compiles nothing.--release, the release one, and written tobuild/<profile>/compile_commands.json, which clang-tidy is given with-p. The compilers are chosen, and a failure to find them reported, as for a build.scrap format: a named file that is not a source of a target, a header among them, is left out with a warning, and when nothing is left the command exits with 0 without looking for clang-tidy.-jat once, by default as many as the system has processors for. Each file is named in aChecking <file>line as it starts, and what clang-tidy wrote for it follows once it has ended. A check in which no file failed ends withFinished debug check, orFinished release check.[check] checksinscrap.tomlis passed as--checks=-*,<checks>, so it takes the place of the checks of.clang-tidyand leaves its other settings in effect.WarningsAsErrorsmakes an error, and with 0 otherwise. The files it failed on are named at the end inerror: failed to check '<file>'lines, with the status clang-tidy exited with when it wrote nothing, followed by one hint. A clang-tidy that cannot be started stops the analysis and is reported once.scrap formatmoves to one place each: writing what a tool wrote to the terminal (ToolOutput), narrowing the files to the paths given with its warnings (selectRequestedFiles), the heading of a tool that failed (renderToolFailureHeading), and the hint after the errors (FixErrorsHint). The output ofscrap buildandscrap formatdoes not change.Tests:
CheckTextTest: 7 tests of the progress lines and of how failures are named.ToolTextTesthas 1 more, for the heading alone. The tests ofprintableOutputmove fromBuildProgressTesttoToolOutputTestas they were.CliE2ETest: 8 tests with a stub clang-tidy, and 5 with the clang-tidy onPATH, which skip when there is none.-jis not seen by these tests beyond being accepted; analyzing files at once is tested with the analysis itself.