Skip to content

Commit ab6e43d

Browse files
Move precommit section
TL;DR
1 parent 577befb commit ab6e43d

File tree

2 files changed

+51
-52
lines changed

2 files changed

+51
-52
lines changed

README.md

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ Be the change et al if Windows is your main and you wanna raise a PR with broad
1717
* [python_template](#python_template)
1818
* [Summary](#summary)
1919
* [Caveat Emptor](#caveat-emptor)
20-
* [Setup](../README.md#setup)
20+
* [Setup](#setup)
2121
* [Usage](#usage)
2222
* [Mac and Linux users](#mac-and-linux-users)
23-
* [git pre-commit hooks](#git-pre-commit-hooks)
2423
* [TODO](#todo)
2524

2625
## Setup
@@ -37,56 +36,6 @@ Be the change et al if Windows is your main and you wanna raise a PR with broad
3736
### Mac and Linux users
3837
Development environments and tooling are first-class citizens on macOS and *nix. For Windows faithfuls, please setup [WSL](markdown/wsl.md).
3938

40-
### git pre-commit hooks
41-
* Install
42-
```bash
43-
# pip
44-
python -m pip install pre-commit
45-
46-
# brew
47-
brew install pre-commit
48-
49-
# install .pre-commit-config.yaml
50-
pre-commit install # install/uninstall
51-
```
52-
* Usage
53-
```bash
54-
# skip pre-commit by ID
55-
SKIP=flake8 git commit -m "foo"
56-
57-
# skip all pre-commit hooks (e.g., bypass false positives like comment preceding docstring)
58-
λ git commit -m "Formatting (WIP)" -m "Debugging formatters" --no-verify
59-
[master d260d56] Formatting (WIP)
60-
1 file changed, 108 insertions(+), 34 deletions(-)
61-
62-
# black dry-run
63-
black --check --diff file_name.py
64-
65-
# skip code block
66-
# fmt: off
67-
68-
import argparse
69-
# from icecream import ic
70-
from pathlib import Path
71-
72-
# fmt: on
73-
74-
# skip individual line (buggy)
75-
# from icecream import ic # fmt: skip
76-
77-
# manually run commit hook against one file
78-
pre-commit run black --files email_it/email_it.py --verbose
79-
80-
# manually run against repo (vs. during commit)
81-
λ pre-commit run --all-files
82-
[INFO] Initializing environment for https://github.com/zricethezav/gitleaks.
83-
<SNIP>
84-
Detect hardcoded secrets.................................................Passed
85-
86-
# update hooks
87-
pre-commit autoupdate
88-
```
89-
9039
## TODO
9140
* Django
9241
* Merge with [docker_python](https://github.com/pythoninthegrass/docker_python) and put the latter on an ice float

markdown/precommit.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
### git pre-commit hooks
2+
3+
* Install
4+
```bash
5+
# pip
6+
python -m pip install pre-commit
7+
8+
# brew
9+
brew install pre-commit
10+
11+
# install .pre-commit-config.yaml
12+
pre-commit install # install/uninstall
13+
```
14+
* Usage
15+
```bash
16+
# skip pre-commit by ID
17+
SKIP=flake8 git commit -m "foo"
18+
19+
# skip all pre-commit hooks (e.g., bypass false positives like comment preceding docstring)
20+
λ git commit -m "Formatting (WIP)" -m "Debugging formatters" --no-verify
21+
[master d260d56] Formatting (WIP)
22+
1 file changed, 108 insertions(+), 34 deletions(-)
23+
24+
# black dry-run
25+
black --check --diff file_name.py
26+
27+
# skip code block
28+
# fmt: off
29+
30+
import argparse
31+
# from icecream import ic
32+
from pathlib import Path
33+
34+
# fmt: on
35+
36+
# skip individual line (buggy)
37+
# from icecream import ic # fmt: skip
38+
39+
# manually run commit hook against one file
40+
pre-commit run black --files email_it/email_it.py --verbose
41+
42+
# manually run against repo (vs. during commit)
43+
λ pre-commit run --all-files
44+
[INFO] Initializing environment for https://github.com/zricethezav/gitleaks.
45+
<SNIP>
46+
Detect hardcoded secrets.................................................Passed
47+
48+
# update hooks
49+
pre-commit autoupdate
50+
```

0 commit comments

Comments
 (0)