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 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)) diff --git a/scripts/docker-buildbot-worker/.flake8 b/scripts/docker-buildbot-worker/.flake8 index 5376b8a..fe38da7 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 +select = C,E,F,W,B,B9 ignore = E203, E501, W503 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,) 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)