Skip to content

Instantly share code, notes, and snippets.

@iafisher
Created April 3, 2020 20:05
Show Gist options
  • Save iafisher/b4c3838cfc7cdb3118e118d2a836b3f3 to your computer and use it in GitHub Desktop.
Save iafisher/b4c3838cfc7cdb3118e118d2a836b3f3 to your computer and use it in GitHub Desktop.
from iafisher_precommit import Precommit, Problem, checks
def main():
precommit = Precommit()
# Generic checks
precommit.register(checks.NoStagedAndUnstagedChanges())
precommit.register(checks.NoWhiteSpaceInFilePath())
# Python checks
precommit.register(checks.PythonFormat())
precommit.register(checks.PythonStyle())
precommit.register(MyCustomCheck())
precommit.run()
class MyCustomCheck:
def check(self, repo_info, path):
if "beef" in path:
return Problem("file path is not vegetarian")
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment