blacklanternsecurity / bbot

A recursive internet scanner for hackers.
https://www.blacklanternsecurity.com/bbot/
GNU General Public License v3.0
4.03k stars 370 forks source link

pre-commit git hooks described in contribution.md, but no example .pre-commit-config.yaml provided #1398

Open colin-stubbs opened 1 month ago

colin-stubbs commented 1 month ago

Description

pre-commit git hooks are described in contribution.md, but no example .pre-commit-config.yaml is provided.

By running poetry run pre-commit install this seems to only install .git/hooks/pre-commit.

This pre-commit file correctly runs python pre-commit in the poetry venv, but because a .pre-commit-config.yaml is still missing the commit will always fail until a valid yaml file is created.

(bbot-py3.12) user@dev-box bbot % poetry run pre-commit install
pre-commit installed at .git/hooks/pre-commit
(bbot-py3.12) user@dev-box bbot %
(bbot-py3.12) user@dev-box bbot % cat .git/hooks/pre-commit
#!/usr/bin/env bash
# File generated by pre-commit: https://pre-commit.com
# ID: 138fd403232d2ddd5efb44317e38bf03

# start templated
INSTALL_PYTHON=/Users/user/Library/Caches/pypoetry/virtualenvs/bbot-XnbrUybI-py3.12/bin/python
ARGS=(hook-impl --config=.pre-commit-config.yaml --hook-type=pre-commit)
# end templated

HERE="$(cd "$(dirname "$0")" && pwd)"
ARGS+=(--hook-dir "$HERE" -- "$@")

if [ -x "$INSTALL_PYTHON" ]; then
    exec "$INSTALL_PYTHON" -mpre_commit "${ARGS[@]}"
elif command -v pre-commit > /dev/null; then
    exec pre-commit "${ARGS[@]}"
else
    echo '`pre-commit` not found.  Did you forget to activate your virtualenv?' 1>&2
    exit 1
fi
(bbot-py3.12) user@dev-box bbot % 

Recommended pre-commit git hook config provided in contribution.md,

e.g. something like?

repos:
-   repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v2.3.0
    hooks:
    -   id: check-yaml
    -   id: end-of-file-fixer
    -   id: trailing-whitespace
-   repo: https://github.com/psf/black
    rev: 24.4.2
    hooks:
    -   id: black