Skip to content

Commit a835649

Browse files
committed
Address review feedback: restore lint check with whitelist, revert taste changes
Per Liam-DeVoe and Zac-HD's feedback: - Revert the "that that" -> "the" change in api-style.rst (intentional construct) - Re-add duplicate-word lint check, but only for unambiguously incorrect duplicates: the, as, a, to, because - Use deferred exit so all lint issues are reported before failing
1 parent ea9895b commit a835649

2 files changed

Lines changed: 20 additions & 3 deletions

File tree

guides/api-style.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ The main reasons for preferring this style are:
149149
* Errors at test import time tend to throw people and be correspondingly hard
150150
for them to debug.
151151
There's an expectation that errors in your test code result in failures in
152-
your tests, and the fact that the test code happens to be defined in a
152+
your tests, and the fact that that test code happens to be defined in a
153153
decorator doesn't seem to change that expectation for people.
154154
* Things like deprecation warnings etc. localize better when they happen
155155
inside the test - test runners will often swallow them or put them in silly

tooling/src/hypothesistooling/__main__.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ def lint():
8080
pip_tool("ruff", "check", ".")
8181
codespell(*(p for p in tools.all_files() if not p.name.endswith("by-domain.txt")))
8282

83+
from textwrap import indent
84+
85+
failed = False
86+
8387
matches = subprocess.run(
8488
r"git grep -En '@(dataclasses\.)?dataclass\(.*\)' "
8589
"| grep -Ev 'frozen=.*slots=|slots=.*frozen='",
@@ -88,10 +92,23 @@ def lint():
8892
text=True,
8993
).stdout
9094
if matches:
91-
from textwrap import indent
92-
9395
print("\nAll dataclass decorators must pass slots= and frozen= arguments:")
9496
print(indent(matches, " "))
97+
failed = True
98+
99+
dupes = subprocess.run(
100+
r"git grep -nP '\b(the|as|a|to|because)\s+\1\b'"
101+
" -- ':!*.svg' ':!*.png' ':!*.jpg' ':!*.sketch'",
102+
shell=True,
103+
capture_output=True,
104+
text=True,
105+
).stdout
106+
if dupes:
107+
print("\nDuplicate word(s) found:")
108+
print(indent(dupes, " "))
109+
failed = True
110+
111+
if failed:
95112
sys.exit(1)
96113

97114

0 commit comments

Comments
 (0)