Run beman-tidy on your library and fix any violations found.
Context:
- Add beman-tidy to library root
.pre-commit-config.yamlfile. Entry example: Notes:
- Use the same
beman-tidystable version from beman-tidy/releases (e.g.,v0.3.1attach example). - Check/test/decide if you want to
- Enable all checks (
requirements+recommendations) ->args: [".", "--verbose", "--require-all"] - Or use default set of checks (only
requirements) -> skipargsfrom config.
- Enable all checks (
Example:
optional [main] $ git diff
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index a9f6e79..629f105 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -45,4 +45,11 @@ repos:
papers/.*
)$
+ # Beman Standard checking via beman-tidy
+ - repo: https://github.com/bemanproject/beman-tidy
+ rev: v0.3.1
+ hooks:
+ - id: beman-tidy
+ args: [".", "--verbose", "--require-all"]
+
exclude: 'infra/'- Run pre-commit checks
- example of Beman Standard compliant repo
optional [main] $ pre-commit run --all-files
trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
check yaml...............................................................Passed
check for added large files..............................................Passed
clang-format.............................................................Passed
CMake linting............................................................Passed
markdownlint.............................................................Passed
codespell................................................................Passed
beman-tidy...............................................................Passed- example of Beman Standard NOT compliant repo
# In this example, --require-all was used inside the pre-commit config.
optional [main] $ pre-commit run --all-files
trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
check yaml...............................................................Passed
check for added large files..............................................Passed
clang-format.............................................................Passed
CMake linting............................................................Passed
markdownlint.............................................................Passed
codespell................................................................Passed
beman-tidy...............................................................Failed
- hook id: beman-tidy
- exit code: 1
beman-tidy pipeline started ...
Running check [Requirement][license.approved] ...
[info][license.approved]: Valid Apache License - Version 2.0 with LLVM Exceptions found in LICENSE file.
check [Requirement][license.approved] ... passed
...
Running check [Requirement][readme.title] ...
[error][readme.title]: The first line of the file 'README.md' is invalid. It should start with '# beman.optional: <short_description>'.
check [Requirement][readme.title] ... failed
...
beman-tidy pipeline finished.
Summary Requirement: 21 checks passed, 1 checks failed, 3 checks skipped, 19 checks not implemented.
Summary Recommendation: 0 checks passed, 0 checks failed, 3 checks skipped, 0 checks not implemented.
Coverage Requirement: 96.43% (27/28 checks passed).
Coverage Recommendation: 0.00% (0/0 checks passed).
Coverage TOTAL: 96.43% (27/28 checks passed).-
Fix violations. Re-run. Considering doing separate PRs for each type of change. Merge these changes into
main. -
Re-run latest
mainof your library. Check that allpre-commithooks (includingbeman-tidy) pass before goint to next step. -
Last step: commit and push changes from
.pre-commit-config.yaml. After this PR is merged, future changes in the repo will be automatically checked via CI (supposing it is configured to run pre-commit)