Skip to content

[developer] Add and explain pre-commit-hook #100

@nemesifier

Description

@nemesifier

In the past we had runflake8, runisort scripts all over the repos.

Now we don't have any script but I realize we may need to reintroduce a script for each repo because the flags passed to openwisp-qa-checks are slightly different for each repo.

This way we can have a run-qa-checks script for each repo and we can create pre-commit-hooks that run the script before each commit.

We can put the hook in each repo automatically as well as suggested here: https://stackoverflow.com/questions/3462955/putting-git-hooks-into-repository

The hook could be saved in openwisp-utils. Python packages could install it automatically in the setup.py script, eg:

  • if the current directory is a git repository and if pip install -e . is being called from within the project itself (eg: check the setup.py script and look for something unique in it)
  • then copy the pre-commit-hook from openwisp-utils and install it / symlink it, whatever

For non python packages we can do something similar as all the repos should have some kind of build/install script/procedure (if they don't have one, we must add one).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Backlog

    Status

    To do (documentation)

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions