@@ -76,6 +76,26 @@ follow these steps:
76
76
77
77
### Static analysis
78
78
79
+ #### Using [`pre-commit`][pre-commit]
80
+ 1. Install pre-commit
81
+
82
+ - Using pip:
83
+ ```shell
84
+ pip install pre-commit
85
+ ```
86
+ - Using homebrew:
87
+ ```shell
88
+ brew install pre-commit
89
+ ```
90
+
91
+ 2. Install the git hook scripts
92
+ ```shell
93
+ pre-commit install
94
+ ```
95
+
96
+ It will run on every commit automatically.
97
+
98
+ #### Using [`dev/tools.sh`][tools-sh] helper script
79
99
The [`dev/tools.sh`][tools-sh] helper script runs the static analysis tools
80
100
(`black`, `flake8`, and `isort`):
81
101
```shell
@@ -89,6 +109,7 @@ directories to check:
89
109
```
90
110
91
111
[tools-sh]: /dev/tools.sh
112
+ [pre-commit]: https://pre-commit.com/
92
113
93
114
94
115
### Resources
@@ -100,12 +121,14 @@ directories to check:
100
121
- [isort][isort]: _A Python utility / library to sort imports_
101
122
- (It doesn' t import any libraries, it only sorts and formats them.)
102
123
- [ppypa/pipenv][pipenv]: _Python Development Workflow for Humans._
124
+ - [pre-commit][pre-commit]: A framework for managing and maintaining multi-language pre-commit hooks.
103
125
104
126
[ccospyguide]: https://opensource.creativecommons.org/contributing-code/python-guidelines/
105
127
[black]: https://github.com/psf/black
106
128
[flake8]: https://gitlab.com/pycqa/flake8
107
129
[isort]: https://pycqa.github.io/isort/
108
130
[pipenv]: https://github.com/pypa/pipenv
131
+ [pre-commit]: https://pre-commit.com/
109
132
110
133
111
134
# ## GitHub Actions
@@ -115,7 +138,7 @@ GitHub Actions workflow performs static analysis (`black`, `flake8`, and
115
138
` isort` ) on committed changes. The workflow is triggered automatically when you
116
139
push changes to the main branch or open a pull request.
117
140
118
- [workflow-static-analysis]: .github/workflows/python_static_analysis .yml
141
+ [workflow-static-analysis]: .github/workflows/static_analysis .yml
119
142
120
143
121
144
# # Data sources
0 commit comments