Devasy Patel commited on
Commit
1bd5436
Β·
unverified Β·
1 Parent(s): abffae5

Add pre-commit hooks and code formatting guidelines (#250)

Browse files

* Add pre-commit hooks and code formatting guidelines

* Update pre-commit hooks and add autopep8 hook

* Add setup-cfg-fmt hook to pre-commit-config.yaml

* Add pre-commit installation instructions

Files changed (3) hide show
  1. .pre-commit-config.yaml +57 -0
  2. CONTRIBUTING.md +28 -6
  3. README.md +25 -0
.pre-commit-config.yaml ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v4.5.0
4
+ hooks:
5
+ - id: trailing-whitespace
6
+ - id: end-of-file-fixer
7
+ - id: check-yaml
8
+ - id: debug-statements
9
+ - id: double-quote-string-fixer
10
+ - id: name-tests-test
11
+ - id: requirements-txt-fixer
12
+ - repo: https://github.com/asottile/setup-cfg-fmt
13
+ rev: v2.5.0
14
+ hooks:
15
+ - id: setup-cfg-fmt
16
+ - repo: https://github.com/psf/black
17
+ rev: 22.10.0
18
+ hooks:
19
+ - id: black
20
+ - repo: https://github.com/pre-commit/mirrors-isort
21
+ rev: v5.9.2
22
+ hooks:
23
+ - id: isort
24
+ args: ["--profile", "black"]
25
+ - repo: https://github.com/PyCQA/flake8
26
+ rev: 7.0.0
27
+ hooks:
28
+ - id: flake8
29
+ - repo: https://github.com/PyCQA/docformatter
30
+ rev: v1.7.1
31
+ hooks:
32
+ - id: docformatter
33
+ additional_dependencies: [tomli]
34
+ args: [--in-place, --config, ./pyproject.toml]
35
+ - repo: https://github.com/pre-commit/mirrors-mypy
36
+ rev: v1.8.0
37
+ hooks:
38
+ - id: mypy
39
+ exclude: ^(docs/|example-plugin/)
40
+ - repo: https://github.com/asottile/pyupgrade
41
+ rev: v3.15.0
42
+ hooks:
43
+ - id: pyupgrade
44
+ args: [--py38-plus]
45
+ - repo: https://github.com/pycqa/pydocstyle
46
+ rev: 6.3.0
47
+ hooks:
48
+ - id: pydocstyle
49
+ - repo: https://github.com/myint/eradicate
50
+ rev: '2.2.0'
51
+ hooks:
52
+ - id: eradicate
53
+ args: []
54
+ - repo: https://github.com/hhatto/autopep8
55
+ rev: v2.1.0
56
+ hooks:
57
+ - id: autopep8
CONTRIBUTING.md CHANGED
@@ -98,7 +98,7 @@ Follow these steps to set up the environment and run the application.
98
  sudo apt-get install python-tk python3-tk tk-dev
99
 
100
  sudo apt-get install build-essential zlib1g-dev libffi-dev libssl-dev libbz2-dev libreadline-dev libsqlite3-dev liblzma-dev
101
-
102
  ```
103
 
104
  - pyenv installer
@@ -109,12 +109,12 @@ Follow these steps to set up the environment and run the application.
109
  ```
110
  pyenv install -v 3.11.0
111
  ```
112
-
113
- - pyenv with virtual enviroment
114
  ```
115
  pyenv virtualenv 3.11.0 venv
116
  ```
117
-
118
  - Activate virtualenv with pyenv
119
  ```
120
  pyenv activate venv
@@ -195,6 +195,29 @@ To run the full stack web application (frontend client and backend api servers),
195
 
196
  <br/>
197
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
  ## Join Us, Contribute!
199
 
200
  Pull Requests & Issues are not just welcomed, they're celebrated! Let's create together.
@@ -209,5 +232,4 @@ Pull Requests & Issues are not just welcomed, they're celebrated! Let's create t
209
 
210
  πŸš€ Explore and improve our [Landing Page](https://github.com/srbhr/website-for-resume-matcher). PRs always welcome!
211
 
212
- πŸ“š Contribute to the [Resume Matcher Docs](https://github.com/srbhr/Resume-Matcher-Docs) and help people get started with using the software.
213
-
 
98
  sudo apt-get install python-tk python3-tk tk-dev
99
 
100
  sudo apt-get install build-essential zlib1g-dev libffi-dev libssl-dev libbz2-dev libreadline-dev libsqlite3-dev liblzma-dev
101
+
102
  ```
103
 
104
  - pyenv installer
 
109
  ```
110
  pyenv install -v 3.11.0
111
  ```
112
+
113
+ - pyenv with virtual enviroment
114
  ```
115
  pyenv virtualenv 3.11.0 venv
116
  ```
117
+
118
  - Activate virtualenv with pyenv
119
  ```
120
  pyenv activate venv
 
195
 
196
  <br/>
197
 
198
+ ## Code Formatting
199
+
200
+ This project uses [Black](https://black.readthedocs.io/en/stable/) for code formatting. We believe this helps to keep the code base consistent and reduces the cognitive load when reading code.
201
+
202
+ Before submitting your pull request, please make sure your changes are in accordance with the Black style guide. You can format your code by running the following command in your terminal:
203
+
204
+ ```sh
205
+ black .
206
+ ```
207
+
208
+ ## Pre-commit Hooks
209
+
210
+ We also use [pre-commit](https://pre-commit.com/) to automatically check for common issues before commits are submitted. This includes checks for code formatting with Black.
211
+
212
+ If you haven't already, please install the pre-commit hooks by running the following command in your terminal:
213
+
214
+ ```sh
215
+ pip install pre-commit
216
+ pre-commit install
217
+ ```
218
+
219
+ Now, the pre-commit hooks will automatically run every time you commit your changes. If any of the hooks fail, the commit will be aborted.
220
+
221
  ## Join Us, Contribute!
222
 
223
  Pull Requests & Issues are not just welcomed, they're celebrated! Let's create together.
 
232
 
233
  πŸš€ Explore and improve our [Landing Page](https://github.com/srbhr/website-for-resume-matcher). PRs always welcome!
234
 
235
+ πŸ“š Contribute to the [Resume Matcher Docs](https://github.com/srbhr/Resume-Matcher-Docs) and help people get started with using the software.
 
README.md CHANGED
@@ -222,6 +222,31 @@ To run the full stack web application (frontend client and backend api servers),
222
 
223
  <div align="center">
224
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
  ## Join Us, Contribute!
226
 
227
  </div>
 
222
 
223
  <div align="center">
224
 
225
+
226
+ ## Code Formatting
227
+
228
+ This project uses [Black](https://black.readthedocs.io/en/stable/) for code formatting. We believe this helps to keep the code base consistent and reduces the cognitive load when reading code.
229
+
230
+ Before submitting your pull request, please make sure your changes are in accordance with the Black style guide. You can format your code by running the following command in your terminal:
231
+
232
+ ```sh
233
+ black .
234
+ ```
235
+
236
+ ## Pre-commit Hooks
237
+
238
+ We also use [pre-commit](https://pre-commit.com/) to automatically check for common issues before commits are submitted. This includes checks for code formatting with Black.
239
+
240
+ If you haven't already, please install the pre-commit hooks by running the following command in your terminal:
241
+
242
+ ```sh
243
+ pip install pre-commit
244
+ pre-commit install
245
+ ```
246
+
247
+ Now, the pre-commit hooks will automatically run every time you commit your changes. If any of the hooks fail, the commit will be aborted.
248
+
249
+
250
  ## Join Us, Contribute!
251
 
252
  </div>