diff --git a/.flake8 b/.flake8 new file mode 100644 index 00000000..d51287a4 --- /dev/null +++ b/.flake8 @@ -0,0 +1,9 @@ +# .flake8 +[flake8] +select = B,B9BLK,C,E,F,I,S,W +ignore = E203,W503,E501 +max-complexity = 10 +max-line-length = 80 +application-import-names = common,src,test,util +import-order-style = google +per-file-ignores = test/*:S101 diff --git a/.gitignore b/.gitignore index adef69c3..e8c87ce7 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ venv/ logs.log config.json .vscode/ +.nox/ diff --git a/dev-requirements.in b/dev-requirements.in index 8fbfcbed..52d255fe 100644 --- a/dev-requirements.in +++ b/dev-requirements.in @@ -1,3 +1,5 @@ pip-tools == 5.3.1 Faker == 2.0.2 -black == 19.10b0 \ No newline at end of file +black == 19.10b0 +nox==2020.8.22 +flake8==3.8.4 \ No newline at end of file diff --git a/dev-requirements.txt b/dev-requirements.txt index 4b2fe87a..9dd93a2b 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -4,19 +4,33 @@ # # pip-compile dev-requirements.in # -appdirs==1.4.4 # via black +appdirs==1.4.4 # via black, virtualenv +argcomplete==1.12.1 # via nox attrs==19.3.0 # via black black==19.10b0 # via -r dev-requirements.in click==7.1.2 # via black, pip-tools +colorlog==4.4.0 # via nox +distlib==0.3.1 # via virtualenv faker==2.0.2 # via -r dev-requirements.in +filelock==3.0.12 # via virtualenv +flake8==3.8.4 # via -r dev-requirements.in +importlib-metadata==2.0.0 # via argcomplete, flake8, nox, virtualenv +importlib-resources==3.2.1 # via virtualenv +mccabe==0.6.1 # via flake8 +nox==2020.8.22 # via -r dev-requirements.in pathspec==0.8.0 # via black pip-tools==5.3.1 # via -r dev-requirements.in +py==1.9.0 # via nox +pycodestyle==2.6.0 # via flake8 +pyflakes==2.2.0 # via flake8 python-dateutil==2.8.0 # via faker regex==2020.7.14 # via black -six==1.12.0 # via faker, pip-tools, python-dateutil +six==1.12.0 # via faker, pip-tools, python-dateutil, virtualenv text-unidecode==1.3 # via faker toml==0.10.1 # via black typed-ast==1.4.1 # via black +virtualenv==20.1.0 # via nox +zipp==3.4.0 # via importlib-metadata, importlib-resources # The following packages are considered to be unsafe in a requirements file: # pip diff --git a/noxfile.py b/noxfile.py new file mode 100644 index 00000000..8da6c77d --- /dev/null +++ b/noxfile.py @@ -0,0 +1,29 @@ +import nox + +# Separating Black away from the rest of the sessions +nox.options.sessions = "lint" +code_locations = "common", "src", "test", "util", "noxfile.py" + + +@nox.session(python="3.6") +def format(session): + args = session.posargs or code_locations + session.run("black", *args, external=True) + + +@nox.session(python="3.6") +def lint(session): + args = session.posargs or code_locations + session.install( + "flake8", + "flake8-bandit", + "flake8-black", + "flake8-bugbear", + "flake8-import-order", + ) + session.run("flake8", *args) + +@nox.session(python="3.6") +def safety(session): + session.install("safety") + session.run("safety", "check", "-r", "requirements.txt", "--full-report")