You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To make the script cross platform and less fragile to file structure, migrate the linter to CMake.
Linting Stages
Check for/insert the license header (must be able to deal with any line endings)
Run clang-format
Run clang-tidy
Targets
Linting of each file should be a target (as linting files is extremely slow) with a target for linting each system, common code and linting everything. To generate all the targets for a project a simple function like add_linter_targets should be created. Note that the name of the targets which lint individual files can be arbitrary.
format, apply stages 1 and 2
check_fast, run stage 1 and 2 only
check, run all stages
Hooks
A pre-commit hook should be created which:
Prints a warning that the checking may take a long time to execute (and that the --no-verify flag can be used to bypass the checks)
Runs check_all
The hook should return a non-zero exit code if the linting fails (this is so that the commit will be aborted). Although I would prefer a two line shell script, if you want to make it cross platform you may be forced to use Python instead.
To allow the hook to be put into our repo it should be located in the utils/git-hooks directory. A line to the README should instruct users to run git config --local core.hooksPath utils/git-hooks/ to enable our hooks.
Checkpoints
All targets exist (but currently no-ops), created with add_linter_targets function
Stage 2 (clang-format, run and apply)
Stage 3 (clang-tidy, run)
Stage 1(license header check, run and apply)
Git hooks
The text was updated successfully, but these errors were encountered:
To make the script cross platform and less fragile to file structure, migrate the linter to CMake.
Linting Stages
clang-format
clang-tidy
Targets
Linting of each file should be a target (as linting files is extremely slow) with a target for linting each system, common code and linting everything. To generate all the targets for a project a simple function like
add_linter_targets
should be created. Note that the name of the targets which lint individual files can be arbitrary.format
, apply stages 1 and 2check_fast
, run stage 1 and 2 onlycheck
, run all stagesHooks
A
pre-commit
hook should be created which:--no-verify
flag can be used to bypass the checks)check_all
The hook should return a non-zero exit code if the linting fails (this is so that the commit will be aborted). Although I would prefer a two line shell script, if you want to make it cross platform you may be forced to use Python instead.
To allow the hook to be put into our repo it should be located in the
utils/git-hooks
directory. A line to the README should instruct users to rungit config --local core.hooksPath utils/git-hooks/
to enable our hooks.Checkpoints
add_linter_targets
functionclang-format
, run and apply)clang-tidy
, run)The text was updated successfully, but these errors were encountered: