Skip to content

Commit eeea03f

Browse files
committed
Lint with isort and bandit
1 parent 413928e commit eeea03f

File tree

11 files changed

+67
-33
lines changed

11 files changed

+67
-33
lines changed

.flake8

Lines changed: 0 additions & 5 deletions
This file was deleted.

.mypy.ini

Lines changed: 0 additions & 18 deletions
This file was deleted.

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ help:
4646
lint: #: Run static analysis with black, flake8, pylint, bandit and mypy
4747
@echo "$(BOLD_CYAN)Blackifying $(RESET_STYLES)🍳"
4848
black $(APP_DIR) $(TEST_DIR) $(HOME_DIR_PY_FILES)
49+
@echo "$(BOLD_CYAN)ISorting 〽️$(RESET_STYLES)"
50+
isort --recursive $(APP_DIR) $(TEST_DIR) $(HOME_DIR_PY_FILES)
4951
@echo "$(BOLD_CYAN)Flaking️❄️$(RESET_STYLES)"
5052
flake8 $(APP_DIR) $(TEST_DIR) $(HOME_DIR_PY_FILES)
51-
@echo "$(BOLD_CYAN)Trying to loot️🕵️️$(RESET_STYLES)"
52-
bandit -l -i -r .
53+
@echo "$(BOLD_CYAN)Securing️🕵️️$(RESET_STYLES)"
54+
bandit -l -i -r . --format=custom
5355

pyproject.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[tool.black]
2+
line-length = 127
3+
target-version = ['py36', 'py37', 'py38']
4+
include = '\.pyi?$'
5+
exclude = '''
6+
/(
7+
\.eggs
8+
| \.git
9+
| \.hg
10+
| \.mypy_cache
11+
| \.tox
12+
| \.venv
13+
| _build
14+
| buck-out
15+
| build
16+
| dist
17+
# The following are specific to Black, you probably don't want those.
18+
| blib2to3
19+
| tests/data
20+
| profiling
21+
)/
22+
'''

service_master.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,5 @@
99
if __name__ == "__main__":
1010
log.info("Created app instance. Initiating run . . .")
1111
app.run(
12-
host=settings.API.SERVER.url,
13-
port=settings.API.SERVER.port,
14-
debug=settings.DEBUG,
12+
host=settings.API.SERVER.url, port=settings.API.SERVER.port, debug=settings.DEBUG,
1513
)

setup.cfg

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[flake8]
2+
max-line-length = 127
3+
max-complexity = 10
4+
# https://www.flake8rules.com/
5+
ignore =
6+
E501, # Line too long (82 > 79 characters)
7+
W503, # Line break occurred before a binary operator
8+
select = B,C,E,F,W,T4,B9
9+
10+
11+
# Global options:
12+
[mypy]
13+
python_version = 3.6
14+
warn_return_any = True
15+
warn_unused_configs = True
16+
ignore_missing_imports = True
17+
18+
# Per-module options:
19+
[*.py]
20+
ignore_missing_imports = True
21+
22+
[src]
23+
ignore_missing_imports = True
24+
25+
[test]
26+
ignore_missing_imports = True
27+
28+
29+
[isort]
30+
multi_line_output=3
31+
include_trailing_comma=True
32+
force_grid_wrap=0
33+
use_parentheses=True

src/core/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from src.core.logger import Logger
2-
from src.core.namespace import Namespace
3-
from src.core.singleton import Singleton
1+
from src.core.logger import Logger # noqa: F401
2+
from src.core.namespace import Namespace # noqa: F401
3+
from src.core.singleton import Singleton # noqa: F401

src/core/logger.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import os
55
import sys
66
from logging.handlers import TimedRotatingFileHandler
7+
78
from dynaconf import settings
89

910
from src.core.singleton import Singleton

src/core/namespace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from flask import Blueprint
21
from dynaconf import settings
2+
from flask import Blueprint
33

44

55
class Namespace(object):

src/routes/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from src.core import Logger
2+
23
from .health import api as health_blueprint
34

45
log = Logger()

0 commit comments

Comments
 (0)