From 506d57920492458bfcb8a454b914bcb730c7e9dd Mon Sep 17 00:00:00 2001 From: Claudio Jolowicz Date: Fri, 20 Sep 2019 18:19:46 +0200 Subject: [PATCH 1/6] Enable complexity checks in flake8 --- scripts/docker-buildbot-worker/.flake8 | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/docker-buildbot-worker/.flake8 b/scripts/docker-buildbot-worker/.flake8 index 5376b8a..703f3c7 100644 --- a/scripts/docker-buildbot-worker/.flake8 +++ b/scripts/docker-buildbot-worker/.flake8 @@ -1,4 +1,5 @@ [flake8] max-line-length = 80 select = C,E,F,W,B,B950 +max-complexity = 10 ignore = E203, E501, W503 From 8ae9d799ffaa6413ea525cba21247b9c48820e07 Mon Sep 17 00:00:00 2001 From: Claudio Jolowicz Date: Fri, 20 Sep 2019 18:20:12 +0200 Subject: [PATCH 2/6] Enable opinionated flake8-bugbear warnings The opinionated warnings provided by flake8-bugbear are disabled by default. This enables the following warnings: B901: Using return x in a generator function. B902: Invalid first argument used for method. B903: Use collections.namedtuple for data classes. B950: Line too long. The warning B950 was already enabled. --- scripts/docker-buildbot-worker/.flake8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/docker-buildbot-worker/.flake8 b/scripts/docker-buildbot-worker/.flake8 index 703f3c7..fe38da7 100644 --- a/scripts/docker-buildbot-worker/.flake8 +++ b/scripts/docker-buildbot-worker/.flake8 @@ -1,5 +1,5 @@ [flake8] max-line-length = 80 -select = C,E,F,W,B,B950 max-complexity = 10 +select = C,E,F,W,B,B9 ignore = E203, E501, W503 From 76c00476f019a8c86e72b1032505127ba926b853 Mon Sep 17 00:00:00 2001 From: Claudio Jolowicz Date: Fri, 20 Sep 2019 18:24:33 +0200 Subject: [PATCH 3/6] Add noxfile --- scripts/docker-buildbot-worker/noxfile.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 scripts/docker-buildbot-worker/noxfile.py diff --git a/scripts/docker-buildbot-worker/noxfile.py b/scripts/docker-buildbot-worker/noxfile.py new file mode 100644 index 0000000..6c75ee4 --- /dev/null +++ b/scripts/docker-buildbot-worker/noxfile.py @@ -0,0 +1,21 @@ +import nox + + +nox.options.sessions = ("lint",) + +locations = "noxfile.py", "docker_buildbot_worker" + + +@nox.session(python="3.7") +def black(session): + """Run black code formatter.""" + session.install("black") + session.run("black", *locations) + + +@nox.session(python="3.7") +def lint(session): + """Lint using flake8.""" + session.install("flake8", "flake8-bugbear", "flake8-import-order", "black") + session.run("black", "--check", *locations) + session.run("flake8", *locations) From f2b4331deca6fed0d480d4b2cbe8fe839aba40af Mon Sep 17 00:00:00 2001 From: Claudio Jolowicz Date: Fri, 20 Sep 2019 18:32:17 +0200 Subject: [PATCH 4/6] Blacken --- .../docker-buildbot-worker/docker_buildbot_worker/core/images.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/docker-buildbot-worker/docker_buildbot_worker/core/images.py b/scripts/docker-buildbot-worker/docker_buildbot_worker/core/images.py index a1dd724..9841ba2 100644 --- a/scripts/docker-buildbot-worker/docker_buildbot_worker/core/images.py +++ b/scripts/docker-buildbot-worker/docker_buildbot_worker/core/images.py @@ -18,6 +18,7 @@ class Image: def release_key(platform): """Return a key function to sort releases.""" + def key(release): if (platform, release) == ("opensuse", "42"): return (14,) From a374dbefe0ba81c5bb60830af835bdca76397161 Mon Sep 17 00:00:00 2001 From: Claudio Jolowicz Date: Fri, 20 Sep 2019 18:36:10 +0200 Subject: [PATCH 5/6] Ignore .nox directory --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 9c882b7..12ae1f4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ __pycache__/ *.egg-info/ +.nox/ \ No newline at end of file From a767e3a5ba29397d6a55704c444c9872d5e7428d Mon Sep 17 00:00:00 2001 From: Claudio Jolowicz Date: Fri, 20 Sep 2019 19:50:24 +0200 Subject: [PATCH 6/6] Update CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51a69fc..dae4062 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix buildbot version in upgraded platforms ([#32](../../pull/32)) - Fix missing m4 dependencies in Python CLI output ([#33](../../pull/33)) +### Added +- Configure flake8 and nox ([#34](../../pull/34)) + ## [2.4.1-1] - 2019-09-20 ### Added - Upgrade to buildbot 2.4.1 ([#29](../../pull/29))