pre-commit is a tool that runs checks during the commit lifecycle; things like ensuring the files being committed have a newline at the end, or conform to a particular style, etc.
Here we configure a few basic quality of life pre-commit hooks:
trailing-whitespace: trim all trailing whitespace
mixed-line-ending: normalize line endings (e.g. LF vs. CRLF)
end-of-file-fixer: add a newline to the end of every file
check-yaml: validate yaml files for basic structure
But the interesting hook is:
openapi-spec-validator: validates the OpenAPI documents for conformance to the OpenAPI spec
pre-commit works locally, and we can configure the https://pre-commit.ci integration with this repo (pending approval) to provide a check that can be run for commits and PRs in GitHub.
pre-commit
is a tool that runs checks during the commit lifecycle; things like ensuring the files being committed have a newline at the end, or conform to a particular style, etc.Here we configure a few basic quality of life
pre-commit
hooks:trailing-whitespace
: trim all trailing whitespacemixed-line-ending
: normalize line endings (e.g. LF vs. CRLF)end-of-file-fixer
: add a newline to the end of every filecheck-yaml
: validate yaml files for basic structureBut the interesting hook is:
openapi-spec-validator
: validates the OpenAPI documents for conformance to the OpenAPI specpre-commit
works locally, and we can configure the https://pre-commit.ci integration with this repo (pending approval) to provide a check that can be run for commits and PRs in GitHub.