diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 77010090965d4..ae518e1902f53 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -85,9 +85,22 @@ repos: entry: tools/png-lint.sh language: script types: [png] + - id: signoff-commit + name: Sign-off Commit + entry: bash + args: + - -c + - | + if ! grep -q "^Signed-off-by: $(git config user.name) <$(git config user.email)>" .git/COMMIT_EDITMSG; then + printf "\nSigned-off-by: $(git config user.name) <$(git config user.email)>\n" >> .git/COMMIT_EDITMSG + fi + language: system + verbose: true + stages: [commit-msg] - id: suggestion name: Suggestion entry: bash -c 'echo "To bypass pre-commit hooks, add --no-verify to git commit."' language: system verbose: true pass_filenames: false + diff --git a/docs/source/contributing/overview.md b/docs/source/contributing/overview.md index 908c7cb4d38ee..af09bfecc6499 100644 --- a/docs/source/contributing/overview.md +++ b/docs/source/contributing/overview.md @@ -26,7 +26,7 @@ Check out the [building from source](#build-from-source) documentation for detai pip install -r requirements-dev.txt # Linting, formatting and static type checking -pre-commit install +pre-commit install --hook-type pre-commit --hook-type commit-msg # You can manually run pre-commit with pre-commit run --all-files diff --git a/format.sh b/format.sh index 4bcd0be0c96e5..3e78bf9865f0d 100755 --- a/format.sh +++ b/format.sh @@ -1,5 +1,6 @@ #!/bin/bash echo "vLLM linting system has been moved from format.sh to pre-commit hook." -echo "Please run 'pip install -r requirements-lint.txt' and 'pre-commit install' to install the pre-commit hook." +echo "Please run 'pip install -r requirements-lint.txt', followed by" +echo "'pre-commit install --hook-type pre-commit --hook-type commit-msg' to install the pre-commit hook." echo "Then linters will run automatically before each commit."