Merge ~cjwatson/lp-signing:pre-commit into lp-signing:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 8e7998ed38225d12e43c2a12ba09a3d158183aba
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/lp-signing:pre-commit
Merge into: lp-signing:master
Diff against target: 301 lines (+259/-2)
5 files modified
.pre-commit-config.yaml (+25/-0)
.woke.yaml (+221/-0)
lp_signing/model/key.py (+1/-1)
lp_signing/tests/test_talisker.py (+1/-1)
setup.cfg (+11/-0)
Reviewer Review Type Date Requested Status
Jürgen Gmach Approve
Review via email: mp+412314@code.launchpad.net

Commit message

Add a basic pre-commit hook

To post a comment you must log in.
Revision history for this message
Jürgen Gmach (jugmac00) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
2new file mode 100644
3index 0000000..8984e28
4--- /dev/null
5+++ b/.pre-commit-config.yaml
6@@ -0,0 +1,25 @@
7+# See https://pre-commit.com for more information
8+# See https://pre-commit.com/hooks.html for more hooks
9+repos:
10+- repo: https://github.com/pre-commit/pre-commit-hooks
11+ rev: v4.0.1
12+ hooks:
13+ - id: check-added-large-files
14+ - id: check-ast
15+ - id: end-of-file-fixer
16+ # Jinja strips a single trailing newline by default, so Jinja
17+ # templates tend to have extra trailing newlines.
18+ exclude_types: [jinja]
19+ - id: check-json
20+ - id: check-merge-conflict
21+ - id: check-xml
22+ - id: check-yaml
23+ - id: debug-statements
24+- repo: https://github.com/PyCQA/flake8
25+ rev: 3.9.2
26+ hooks:
27+ - id: flake8
28+- repo: https://github.com/get-woke/woke
29+ rev: ee781d3ce0ddf835267764f27f4ffdd2dd21fa27
30+ hooks:
31+ - id: woke-from-source
32diff --git a/.woke.yaml b/.woke.yaml
33new file mode 100644
34index 0000000..010ccff
35--- /dev/null
36+++ b/.woke.yaml
37@@ -0,0 +1,221 @@
38+
39+# Based on Canonical's Guidelines
40+# https://docs.google.com/document/d/1mJUa1VJHOMWa723dmKmNjSKGW-nlBv9xktzGZZwacVo/edit#heading=h.5efudb237qdb
41+rules:
42+ - name: whitelist
43+ terms:
44+ - whitelist
45+ - white-list
46+ - whitelisted
47+ - white-listed
48+ alternatives:
49+ - allowlist
50+ - inclusion list
51+ severity: warning
52+ note: "The underlying assumption of the whitelist/blacklist metaphor is that white = good and black = bad. Because colors in and of themselves have no predetermined meaning, any meaning we assign to them is cultural: for example, the color red in many Southeast Asian countries is lucky, and is often associated with events like marriages, whereas the color white carries the same connotations in many European countries. In the case of whitelist/blacklist, the terms originate in the publishing industry – one dominated by the USA and England, two countries which participated in slavery and which grapple with their racist legacies to this day."
53+
54+ - name: blacklist
55+ terms:
56+ - blacklist
57+ - black-list
58+ - blacklisted
59+ - black-listed
60+ alternatives:
61+ - denylist
62+ - blocklist
63+ - exclusion list
64+ severity: warning
65+ note: "The underlying assumption of the whitelist/blacklist metaphor is that white = good and black = bad. Because colors in and of themselves have no predetermined meaning, any meaning we assign to them is cultural: for example, the color red in many Southeast Asian countries is lucky, and is often associated with events like marriages, whereas the color white carries the same connotations in many European countries. In the case of whitelist/blacklist, the terms originate in the publishing industry – one dominated by the USA and England, two countries which participated in slavery and which grapple with their racist legacies to this day."
66+
67+ - name: master-slave
68+ terms:
69+ - master-slave
70+ - master/slave
71+ alternatives:
72+ - leader/follower
73+ - main/replica
74+ - primary/replica
75+ - primary/standby
76+ - primary/secondary
77+
78+ - name: slave
79+ terms:
80+ - slave
81+ alternatives:
82+ - follower
83+ - replica
84+ - standby
85+
86+ - name: grandfathered
87+ terms:
88+ - grandfathered
89+ alternatives:
90+ - legacy status
91+ - legacied
92+ - exempted
93+ - carried
94+ - brought forward
95+ - rolled over
96+
97+ - name: man-hours
98+ terms:
99+ - man hours
100+ - man-hours
101+ alternatives:
102+ - person hours
103+ - engineer hours
104+
105+ - name: sanity
106+ terms:
107+ - sanity
108+ alternatives:
109+ - confidence
110+ - quick check
111+ - coherence check
112+
113+ - name: dummy
114+ terms:
115+ - dummy
116+ alternatives:
117+ - placeholder
118+ - sample
119+
120+ - name: guys
121+ terms:
122+ - guys
123+ alternatives:
124+ - folks
125+ - people
126+ - you all
127+ - y'all
128+ - yinz
129+
130+ - name: whitebox
131+ terms:
132+ - white-box
133+ - whitebox
134+ - white box
135+ alternatives:
136+ - open-box
137+
138+ - name: blackbox
139+ terms:
140+ - black-box
141+ - blackbox
142+ - black box
143+ alternatives:
144+ - closed-box
145+
146+ - name: blackhat
147+ terms:
148+ - blackhat
149+ - black-hat
150+ - black hat
151+ alternatives:
152+ - attacker
153+ - malicious actor
154+
155+ - name: whitehat
156+ terms:
157+ - whitehat
158+ - white-hat
159+ - white hat
160+ alternatives:
161+ - researcher
162+ - security specialist
163+
164+ - name: illegal characters
165+ terms:
166+ - illegal characters
167+ alternatives:
168+ - invalid characters
169+ - unsupported characters
170+ - special characters
171+
172+ - name: native feature
173+ terms:
174+ - native feature
175+ alternatives:
176+ - core feature
177+ - built-in feature
178+
179+ - name: chairman/foreman
180+ terms:
181+ - chairman
182+ - foreman
183+ alternatives:
184+ - chair
185+ - foreperson
186+
187+ - name: man in the middle
188+ terms:
189+ - man in the middle
190+ - man-in-the-middle
191+ alternatives:
192+ - machine-in-the-middle
193+ - person-in-the-middle
194+ - system-in-the-middle
195+ - intermediary attack
196+
197+ - name: middleman
198+ terms:
199+ - middleman
200+ alternatives:
201+ - middleperson
202+ - intermediary
203+
204+ - name: manned
205+ terms:
206+ - manned
207+ alternatives:
208+ - crewed
209+ - staffed
210+ - monitored
211+ - human operated
212+
213+ - name: mom test / girlfriend test
214+ terms:
215+ - mom test
216+ - girlfriend test
217+ alternatives:
218+ - user test
219+ - user friendly
220+
221+ - name: crazy
222+ terms:
223+ - crazy
224+ alternatives:
225+ - baffling
226+ - unexplained
227+ - errant
228+
229+ - name: cripples
230+ terms:
231+ - cripples
232+ alternatives:
233+ - slows down
234+ - hinders
235+ - obstructs
236+
237+ - name: crippling
238+ terms:
239+ - crippling
240+ alternatives:
241+ - attenuating
242+ - incapacitating
243+
244+ - name: stonith/stomith
245+ terms:
246+ - stonith
247+ - stomith
248+ alternatives:
249+ - fence failed nodes
250+ - machines
251+
252+ - name: demilitarized zone
253+ terms:
254+ - demilitarized zone
255+ - dmz
256+ alternatives:
257+ - perimeter network
258+ - passthrough network
259diff --git a/lp_signing/model/key.py b/lp_signing/model/key.py
260index 7ba629d..ebcfc6a 100644
261--- a/lp_signing/model/key.py
262+++ b/lp_signing/model/key.py
263@@ -134,7 +134,7 @@ def _gpg_context(tmp):
264 home.mkdir(mode=0o700)
265 try:
266 (home / "gpg.conf").write_text(_gpg_conf)
267- (home / "gpg-agent.conf").write_text(dedent(f"""\
268+ (home / "gpg-agent.conf").write_text(dedent("""\
269 disable-scdaemon
270 """))
271
272diff --git a/lp_signing/tests/test_talisker.py b/lp_signing/tests/test_talisker.py
273index e742841..9abf818 100644
274--- a/lp_signing/tests/test_talisker.py
275+++ b/lp_signing/tests/test_talisker.py
276@@ -4,7 +4,7 @@
277 """Test talisker-specific behavior.
278
279 There shouldn't be many tests here, and they should all run talisker and
280-examine its behavior, treating the service as a black-box.
281+examine its behavior, treating the service as a closed box.
282 """
283
284 import os
285diff --git a/setup.cfg b/setup.cfg
286new file mode 100644
287index 0000000..6a93b1a
288--- /dev/null
289+++ b/setup.cfg
290@@ -0,0 +1,11 @@
291+[flake8]
292+ignore =
293+ # will be fixed by using black
294+ E121
295+ E123
296+ E126
297+ # incompatible with black
298+ E203
299+ # binary operator on same or next line; mutually exclusive
300+ W503
301+ W504

Subscribers

People subscribed via source and target branches