fediverse-devnet / feditest

A testing framework for distributed, heterogeneous systems communicating with complex protocols, such as the Fediverse
https://feditest.org/
MIT License
33 stars 6 forks source link

Initial pre-commit support. #313

Closed steve-bate closed 2 months ago

steve-bate commented 2 months ago

See also: #259

Most of the checks are currently commented out because it's going to "clean up" a lot of files (and will flag many more as needing manual intervention). I thought I'd enable them one at a time and submit a PR with the changes. I also need to see how to use the pytest support given our somewhat ad hoc venv approach (the checks run in their own isolated virtual environment).

To use this:


pip install pre-commit  # or however you are installing feditest dependencies

# add a git hook to invoke pre-commit before a push
# the pre-push git hook is defined as the default
pre-commit install 

# to run manually
pre-commit run -a

# to run a specific check manually
pre-commit run -a <check-id>

# to bypass the pre-commit hook
git push --no-verify
steve-bate commented 2 months ago

The NOCOMMIT check supports putting that string in a file somewhere to prevent it from being committed (or pushed in this case).

def some_function():
  hacked_up_stuff = "foobar" # NOCOMMIT
 ...
jernst commented 2 months ago

Are you still working on this or is this ready to merge?

steve-bate commented 2 months ago

Are you still working on this or is this ready to merge?

Ready for initial merge.