Skip to content

Commit aaa3b44

Browse files
authored
Merge pull request #5776: Use flake8 (via pantsbuild)
2 parents 0d94df3 + 9a9dc29 commit aaa3b44

File tree

10 files changed

+367
-2
lines changed

10 files changed

+367
-2
lines changed

.github/workflows/lint.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ on:
2525
jobs:
2626
# Lint checks which don't depend on any service containes, etc. to be running.
2727
lint-checks:
28-
name: 'Lint Checks (pants runs: shellcheck, black)'
28+
name: 'Lint Checks (pants runs: shellcheck, black, flake8)'
2929
runs-on: ubuntu-latest
3030

3131
env:

CHANGELOG.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Added
5353

5454
* Begin introducing `pants <https://www.pantsbuild.org/docs>`_ to improve DX (Developer Experience)
5555
working on StackStorm, improve our security posture, and improve CI reliability thanks in part
56-
to pants' use of PEX lockfiles. This is not a user-facing addition. #5713 #5724 #5726 #5725 #5732 #5733 #5737 #5738 #5758 #5751 #5774
56+
to pants' use of PEX lockfiles. This is not a user-facing addition. #5713 #5724 #5726 #5725 #5732 #5733 #5737 #5738 #5758 #5751 #5774 #5776
5757
Contributed by @cognifloyd
5858

5959
Changed

lockfiles/flake8.lock

+349
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,349 @@
1+
// This lockfile was autogenerated by Pants. To regenerate, run:
2+
//
3+
// ./pants generate-lockfiles --resolve=flake8
4+
//
5+
// --- BEGIN PANTS LOCKFILE METADATA: DO NOT EDIT OR REMOVE ---
6+
// {
7+
// "version": 3,
8+
// "valid_for_interpreter_constraints": [
9+
// "CPython<4,>=3.7"
10+
// ],
11+
// "generated_with_requirements": [
12+
// "flake8==4.0.1",
13+
// "st2flake8==0.1.0"
14+
// ],
15+
// "manylinux": "manylinux2014",
16+
// "requirement_constraints": [],
17+
// "only_binary": [],
18+
// "no_binary": []
19+
// }
20+
// --- END PANTS LOCKFILE METADATA ---
21+
22+
{
23+
"allow_builds": true,
24+
"allow_prereleases": false,
25+
"allow_wheels": true,
26+
"build_isolation": true,
27+
"constraints": [],
28+
"locked_resolves": [
29+
{
30+
"locked_requirements": [
31+
{
32+
"artifacts": [
33+
{
34+
"algorithm": "sha256",
35+
"hash": "479b1304f72536a55948cb40a32dce8bb0ffe3501e26eaf292c7e60eb5e0428d",
36+
"url": "https://files.pythonhosted.org/packages/34/39/cde2c8a227abb4f9ce62fe55586b920f438f1d2903a1a22514d0b982c333/flake8-4.0.1-py2.py3-none-any.whl"
37+
},
38+
{
39+
"algorithm": "sha256",
40+
"hash": "806e034dda44114815e23c16ef92f95c91e4c71100ff52813adf7132a6ad870d",
41+
"url": "https://files.pythonhosted.org/packages/e6/84/d8db922289195c435779b4ca3a3f583f263f87e67954f7b2e83c8da21f48/flake8-4.0.1.tar.gz"
42+
}
43+
],
44+
"project_name": "flake8",
45+
"requires_dists": [
46+
"importlib-metadata<4.3; python_version < \"3.8\"",
47+
"mccabe<0.7.0,>=0.6.0",
48+
"pycodestyle<2.9.0,>=2.8.0",
49+
"pyflakes<2.5.0,>=2.4.0"
50+
],
51+
"requires_python": ">=3.6",
52+
"version": "4.0.1"
53+
},
54+
{
55+
"artifacts": [
56+
{
57+
"algorithm": "sha256",
58+
"hash": "dbad92ee5f51398722cd571b6e36cc3651914bf1b286b0e638bba1f4af0b6f5b",
59+
"url": "https://files.pythonhosted.org/packages/af/9c/a8ad17f373dfad4c0fea345290ef8ce54d63b76a3166d6bb57030d7a6d59/flake8_copyright-0.2.2-py3-none-any.whl"
60+
},
61+
{
62+
"algorithm": "sha256",
63+
"hash": "616a960c9602ad2d0136bf3f12564e253caffe82f151d2982f78a12a42e1faa0",
64+
"url": "https://files.pythonhosted.org/packages/17/83/19b630889d8c3291a04ddb6ab5bf691618a07a11be239c15f2b524708b93/flake8_copyright-0.2.2-py2.py3-none-any.whl"
65+
},
66+
{
67+
"algorithm": "sha256",
68+
"hash": "5c3632dd8c586547b25fff4272282005fdbcba56eeb77b7487564aa636b6e533",
69+
"url": "https://files.pythonhosted.org/packages/66/35/3a5712611f8345329582817c71db68f6a1b6f4d500efeaeca1137b241417/flake8-copyright-0.2.2.tar.gz"
70+
}
71+
],
72+
"project_name": "flake8-copyright",
73+
"requires_dists": [
74+
"setuptools"
75+
],
76+
"requires_python": null,
77+
"version": "0.2.2"
78+
},
79+
{
80+
"artifacts": [
81+
{
82+
"algorithm": "sha256",
83+
"hash": "12be6a34ee3ab795b19ca73505e7b55826d5f6ad7230d31b18e106400169b9e9",
84+
"url": "https://files.pythonhosted.org/packages/86/b5/a43fed6fd0193585d17d6faa7b85317d4461f694aaed546098c69f856579/flake8_polyfill-1.0.2-py2.py3-none-any.whl"
85+
},
86+
{
87+
"algorithm": "sha256",
88+
"hash": "e44b087597f6da52ec6393a709e7108b2905317d0c0b744cdca6208e670d8eda",
89+
"url": "https://files.pythonhosted.org/packages/e6/67/1c26634a770db5c442e361311bee73cb3a177adb2eb3f7af8953cfd9f553/flake8-polyfill-1.0.2.tar.gz"
90+
}
91+
],
92+
"project_name": "flake8-polyfill",
93+
"requires_dists": [
94+
"flake8"
95+
],
96+
"requires_python": null,
97+
"version": "1.0.2"
98+
},
99+
{
100+
"artifacts": [
101+
{
102+
"algorithm": "sha256",
103+
"hash": "057e92c15bc8d9e8109738a48db0ccb31b4d9d5cfbee5a8670879a30be66304b",
104+
"url": "https://files.pythonhosted.org/packages/22/51/52442c59db26637681148c21f8984eed58c9db67053a0a4783a047010c98/importlib_metadata-4.2.0-py3-none-any.whl"
105+
},
106+
{
107+
"algorithm": "sha256",
108+
"hash": "b7e52a1f8dec14a75ea73e0891f3060099ca1d8e6a462a4dff11c3e119ea1b31",
109+
"url": "https://files.pythonhosted.org/packages/c7/7c/126a8686399ebe256b5e4343ea80b6f2ee91549969da2eef0bb2891b8d24/importlib_metadata-4.2.0.tar.gz"
110+
}
111+
],
112+
"project_name": "importlib-metadata",
113+
"requires_dists": [
114+
"flufl.flake8; extra == \"testing\"",
115+
"importlib-resources>=1.3; python_version < \"3.9\" and extra == \"testing\"",
116+
"jaraco.packaging>=8.2; extra == \"docs\"",
117+
"packaging; extra == \"testing\"",
118+
"pep517; extra == \"testing\"",
119+
"pyfakefs; extra == \"testing\"",
120+
"pytest-black>=0.3.7; (platform_python_implementation != \"PyPy\" and python_version < \"3.10\") and extra == \"testing\"",
121+
"pytest-checkdocs>=2.4; extra == \"testing\"",
122+
"pytest-cov; extra == \"testing\"",
123+
"pytest-enabler>=1.0.1; extra == \"testing\"",
124+
"pytest-flake8; extra == \"testing\"",
125+
"pytest-mypy; (platform_python_implementation != \"PyPy\" and python_version < \"3.10\") and extra == \"testing\"",
126+
"pytest>=4.6; extra == \"testing\"",
127+
"rst.linker>=1.9; extra == \"docs\"",
128+
"sphinx; extra == \"docs\"",
129+
"typing-extensions>=3.6.4; python_version < \"3.8\"",
130+
"zipp>=0.5"
131+
],
132+
"requires_python": ">=3.6",
133+
"version": "4.2"
134+
},
135+
{
136+
"artifacts": [
137+
{
138+
"algorithm": "sha256",
139+
"hash": "ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42",
140+
"url": "https://files.pythonhosted.org/packages/87/89/479dc97e18549e21354893e4ee4ef36db1d237534982482c3681ee6e7b57/mccabe-0.6.1-py2.py3-none-any.whl"
141+
},
142+
{
143+
"algorithm": "sha256",
144+
"hash": "dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f",
145+
"url": "https://files.pythonhosted.org/packages/06/18/fa675aa501e11d6d6ca0ae73a101b2f3571a565e0f7d38e062eec18a91ee/mccabe-0.6.1.tar.gz"
146+
}
147+
],
148+
"project_name": "mccabe",
149+
"requires_dists": [],
150+
"requires_python": null,
151+
"version": "0.6.1"
152+
},
153+
{
154+
"artifacts": [
155+
{
156+
"algorithm": "sha256",
157+
"hash": "720f8b39dde8b293825e7ff02c475f3077124006db4f440dcbc9a20b76548a20",
158+
"url": "https://files.pythonhosted.org/packages/15/94/bc43a2efb7b8615e38acde2b6624cae8c9ec86faf718ff5676c5179a7714/pycodestyle-2.8.0-py2.py3-none-any.whl"
159+
},
160+
{
161+
"algorithm": "sha256",
162+
"hash": "eddd5847ef438ea1c7870ca7eb78a9d47ce0cdb4851a5523949f2601d0cbbe7f",
163+
"url": "https://files.pythonhosted.org/packages/08/dc/b29daf0a202b03f57c19e7295b60d1d5e1281c45a6f5f573e41830819918/pycodestyle-2.8.0.tar.gz"
164+
}
165+
],
166+
"project_name": "pycodestyle",
167+
"requires_dists": [],
168+
"requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7",
169+
"version": "2.8"
170+
},
171+
{
172+
"artifacts": [
173+
{
174+
"algorithm": "sha256",
175+
"hash": "3bb3a3f256f4b7968c9c788781e4ff07dce46bdf12339dcda61053375426ee2e",
176+
"url": "https://files.pythonhosted.org/packages/43/fb/38848eb494af7df9aeb2d7673ace8b213313eb7e391691a79dbaeb6a838f/pyflakes-2.4.0-py2.py3-none-any.whl"
177+
},
178+
{
179+
"algorithm": "sha256",
180+
"hash": "05a85c2872edf37a4ed30b0cce2f6093e1d0581f8c19d7393122da7e25b2b24c",
181+
"url": "https://files.pythonhosted.org/packages/15/60/c577e54518086e98470e9088278247f4af1d39cb43bcbd731e2c307acd6a/pyflakes-2.4.0.tar.gz"
182+
}
183+
],
184+
"project_name": "pyflakes",
185+
"requires_dists": [],
186+
"requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7",
187+
"version": "2.4"
188+
},
189+
{
190+
"artifacts": [
191+
{
192+
"algorithm": "sha256",
193+
"hash": "f62ea9da9ed6289bfe868cd6845968a2c854d1427f8548d52cae02a42b4f0356",
194+
"url": "https://files.pythonhosted.org/packages/41/82/7f54bbfe5c247a8c9f78d8d1d7c051847bcb78843c397b866dba335c1e88/setuptools-65.5.0-py3-none-any.whl"
195+
},
196+
{
197+
"algorithm": "sha256",
198+
"hash": "512e5536220e38146176efb833d4a62aa726b7bbff82cfbc8ba9eaa3996e0b17",
199+
"url": "https://files.pythonhosted.org/packages/c5/41/247814d8b7a044717164c74080725a6c8f3d2b5fc82b34bd825b617df663/setuptools-65.5.0.tar.gz"
200+
}
201+
],
202+
"project_name": "setuptools",
203+
"requires_dists": [
204+
"build[virtualenv]; extra == \"testing\"",
205+
"build[virtualenv]; extra == \"testing-integration\"",
206+
"filelock>=3.4.0; extra == \"testing\"",
207+
"filelock>=3.4.0; extra == \"testing-integration\"",
208+
"flake8-2020; extra == \"testing\"",
209+
"flake8<5; extra == \"testing\"",
210+
"furo; extra == \"docs\"",
211+
"ini2toml[lite]>=0.9; extra == \"testing\"",
212+
"jaraco.envs>=2.2; extra == \"testing\"",
213+
"jaraco.envs>=2.2; extra == \"testing-integration\"",
214+
"jaraco.packaging>=9; extra == \"docs\"",
215+
"jaraco.path>=3.2.0; extra == \"testing\"",
216+
"jaraco.path>=3.2.0; extra == \"testing-integration\"",
217+
"jaraco.tidelift>=1.4; extra == \"docs\"",
218+
"mock; extra == \"testing\"",
219+
"pip-run>=8.8; extra == \"testing\"",
220+
"pip>=19.1; extra == \"testing\"",
221+
"pygments-github-lexers==0.0.5; extra == \"docs\"",
222+
"pytest-black>=0.3.7; platform_python_implementation != \"PyPy\" and extra == \"testing\"",
223+
"pytest-checkdocs>=2.4; extra == \"testing\"",
224+
"pytest-cov; platform_python_implementation != \"PyPy\" and extra == \"testing\"",
225+
"pytest-enabler; extra == \"testing-integration\"",
226+
"pytest-enabler>=1.3; extra == \"testing\"",
227+
"pytest-flake8; extra == \"testing\"",
228+
"pytest-mypy>=0.9.1; platform_python_implementation != \"PyPy\" and extra == \"testing\"",
229+
"pytest-perf; extra == \"testing\"",
230+
"pytest-xdist; extra == \"testing\"",
231+
"pytest-xdist; extra == \"testing-integration\"",
232+
"pytest; extra == \"testing-integration\"",
233+
"pytest>=6; extra == \"testing\"",
234+
"rst.linker>=1.9; extra == \"docs\"",
235+
"sphinx-favicon; extra == \"docs\"",
236+
"sphinx-hoverxref<2; extra == \"docs\"",
237+
"sphinx-inline-tabs; extra == \"docs\"",
238+
"sphinx-notfound-page==0.8.3; extra == \"docs\"",
239+
"sphinx-reredirects; extra == \"docs\"",
240+
"sphinx>=3.5; extra == \"docs\"",
241+
"sphinxcontrib-towncrier; extra == \"docs\"",
242+
"tomli-w>=1.0.0; extra == \"testing\"",
243+
"tomli; extra == \"testing-integration\"",
244+
"virtualenv>=13.0.0; extra == \"testing\"",
245+
"virtualenv>=13.0.0; extra == \"testing-integration\"",
246+
"wheel; extra == \"testing\"",
247+
"wheel; extra == \"testing-integration\""
248+
],
249+
"requires_python": ">=3.7",
250+
"version": "65.5"
251+
},
252+
{
253+
"artifacts": [
254+
{
255+
"algorithm": "sha256",
256+
"hash": "8e163d489ca8d20a43ccd428acbefdfd451fb38d624d140e6711d510530db01a",
257+
"url": "https://files.pythonhosted.org/packages/81/4c/8ece3543c6153bbf1883629e5fe7270b43aebf0bd7c85c552aedc0555b13/st2flake8-0.1.0-py3-none-any.whl"
258+
},
259+
{
260+
"algorithm": "sha256",
261+
"hash": "4808e5ba811b792eec8a255988a3d1d3e615768dbc89d043774cf821d4584a8f",
262+
"url": "https://files.pythonhosted.org/packages/64/c7/9b6dd9ba15a44a6fd9aa733beb4a2ca9d9234bf57b8a828d4b6c127fe427/st2flake8-0.1.0.tar.gz"
263+
}
264+
],
265+
"project_name": "st2flake8",
266+
"requires_dists": [
267+
"flake8-copyright==0.2.2",
268+
"flake8-polyfill==1.0.2"
269+
],
270+
"requires_python": null,
271+
"version": "0.1"
272+
},
273+
{
274+
"artifacts": [
275+
{
276+
"algorithm": "sha256",
277+
"hash": "16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e",
278+
"url": "https://files.pythonhosted.org/packages/0b/8e/f1a0a5a76cfef77e1eb6004cb49e5f8d72634da638420b9ea492ce8305e8/typing_extensions-4.4.0-py3-none-any.whl"
279+
},
280+
{
281+
"algorithm": "sha256",
282+
"hash": "1511434bb92bf8dd198c12b1cc812e800d4181cfcb867674e0f8279cc93087aa",
283+
"url": "https://files.pythonhosted.org/packages/e3/a7/8f4e456ef0adac43f452efc2d0e4b242ab831297f1bac60ac815d37eb9cf/typing_extensions-4.4.0.tar.gz"
284+
}
285+
],
286+
"project_name": "typing-extensions",
287+
"requires_dists": [],
288+
"requires_python": ">=3.7",
289+
"version": "4.4"
290+
},
291+
{
292+
"artifacts": [
293+
{
294+
"algorithm": "sha256",
295+
"hash": "972cfa31bc2fedd3fa838a51e9bc7e64b7fb725a8c00e7431554311f180e9980",
296+
"url": "https://files.pythonhosted.org/packages/09/85/302c153615db93e9197f13e02f448b3f95d7d786948f2fb3d6d5830a481b/zipp-3.9.0-py3-none-any.whl"
297+
},
298+
{
299+
"algorithm": "sha256",
300+
"hash": "3a7af91c3db40ec72dd9d154ae18e008c69efe8ca88dde4f9a731bb82fe2f9eb",
301+
"url": "https://files.pythonhosted.org/packages/41/2e/1341c5634c25e7254df01ec1f6cbd2bcdee3e647709e7c3647d1b362e3ac/zipp-3.9.0.tar.gz"
302+
}
303+
],
304+
"project_name": "zipp",
305+
"requires_dists": [
306+
"flake8<5; extra == \"testing\"",
307+
"func-timeout; extra == \"testing\"",
308+
"furo; extra == \"docs\"",
309+
"jaraco.functools; extra == \"testing\"",
310+
"jaraco.itertools; extra == \"testing\"",
311+
"jaraco.packaging>=9; extra == \"docs\"",
312+
"jaraco.tidelift>=1.4; extra == \"docs\"",
313+
"more-itertools; extra == \"testing\"",
314+
"pytest-black>=0.3.7; platform_python_implementation != \"PyPy\" and extra == \"testing\"",
315+
"pytest-checkdocs>=2.4; extra == \"testing\"",
316+
"pytest-cov; extra == \"testing\"",
317+
"pytest-enabler>=1.3; extra == \"testing\"",
318+
"pytest-flake8; extra == \"testing\"",
319+
"pytest-mypy>=0.9.1; platform_python_implementation != \"PyPy\" and extra == \"testing\"",
320+
"pytest>=6; extra == \"testing\"",
321+
"rst.linker>=1.9; extra == \"docs\"",
322+
"sphinx>=3.5; extra == \"docs\""
323+
],
324+
"requires_python": ">=3.7",
325+
"version": "3.9"
326+
}
327+
],
328+
"platform_tag": null
329+
}
330+
],
331+
"path_mappings": {},
332+
"pex_version": "2.1.103",
333+
"prefer_older_binary": false,
334+
"requirements": [
335+
"flake8==4.0.1",
336+
"st2flake8==0.1.0"
337+
],
338+
"requires_python": [
339+
"<4,>=3.7"
340+
],
341+
"resolver_version": "pip-2020-resolver",
342+
"style": "universal",
343+
"target_systems": [
344+
"linux",
345+
"mac"
346+
],
347+
"transitive": true,
348+
"use_pep517": null
349+
}

pants.toml

+10
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ backend_packages = [
1313
"pants.backend.experimental.python", # activates twine `publish` support
1414
"pants.backend.python.mixed_interpreter_constraints",
1515
"pants.backend.python.lint.black",
16+
"pants.backend.python.lint.flake8",
1617

1718
# shell
1819
"pants.backend.shell",
@@ -85,3 +86,12 @@ root_patterns = [
8586
[black]
8687
lockfile = "lockfiles/black.lock"
8788
version = "black==22.3.0"
89+
90+
[flake8]
91+
lockfile = "lockfiles/flake8.lock"
92+
version = "flake8==4.0.1" # st2flake8 does not support flake8 v5
93+
extra_requirements = [
94+
# license check plugin
95+
"st2flake8==0.1.0", # TODO: remove in favor of regex-lint
96+
]
97+
config = "lint-configs/python/.flake8"

st2actions/bin/BUILD

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
python_sources(
22
sources=["st2*"],
3+
skip_flake8=True,
34
)
45

56
shell_sources(

0 commit comments

Comments
 (0)