blob: bf52b5c12b8e75daa86a55ed37b66474ab410db3 [file] [log] [blame]
Joey Armstrong34690ba2024-04-15 12:45:39 -04001.. _Makefile Target lint-pre-commit:
2
3Tool: pre-commit
4================
5
6The `pre-commit tool <https://pre-commit.com/>`__ can also be used to:
7
8- Scan for a variety of problems: syntax, licensing, etc.
9- Perform some code cleanups
10
11 - Remove whitespace
12 - re-indent files
13 - etc
14
15## Install
16
17.. code:: bash
18
19 % git clone ssh://gerrit.opencord.org:29418/bbsim.git
20 % cd bbsim
21
22 % make help
23
24 # Install python virtualenv w/modules from requirements.txt
25 % make venv
26 % source .venv/bin/activate
27
28 # Scan for problems
29 % pre-commit
30
31 % make clean
32
33## Configuration
34
35- Each repository contains a yaml config file that controls hooks and linting behavior:
36
37 - repo:bbsim/`.pre-commit-config.yaml <https://gerrit.opencord.org/plugins/gitiles/bbsim/+/refs/heads/master/.pre-commit-config.yaml>`__
38
39- A skeleton config is currently being used.
40- Make changes as needed but be sure to propogate them out to all voltha repositories.
41- Long term a central repository can be maintained for pre-commit hooks that can be
42 included as a git submodule to remove duplication and potential for linting variations.
43
44.. seealso:
45
46| URL | Description |
47| pre-commit | A framework for managing and maintaining multi-language pre-commit hooks |