add autopep8 source formatter

This commit is contained in:
sebthom
2022-02-01 06:46:22 +01:00
parent 92dbc6615b
commit dfc6481541
4 changed files with 53 additions and 3 deletions

View File

@@ -69,6 +69,8 @@ jobs:
run: | run: |
pdm run lint pdm run lint
pdm run autopep8 -v --exit-code --recursive --diff kleinanzeigen_bot tests
- name: run unit tests - name: run unit tests
run: | run: |
pdm run test pdm run test

View File

@@ -268,6 +268,7 @@ updated_on: # set automatically
> Please read [CONTRIBUTING.md](CONTRIBUTING.md) before contributing code. Thank you! > Please read [CONTRIBUTING.md](CONTRIBUTING.md) before contributing code. Thank you!
- Format source code: `pdm run format`
- Running unit tests: `pdm run test` - Running unit tests: `pdm run test`
- Running linter: `pdm run lint` - Running linter: `pdm run lint`
- Creating platform-specific executable: `pdm run compile` - Creating platform-specific executable: `pdm run compile`

25
pdm.lock generated
View File

@@ -32,6 +32,15 @@ version = "21.4.0"
requires_python = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" requires_python = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
summary = "Classes Without Boilerplate" summary = "Classes Without Boilerplate"
[[package]]
name = "autopep8"
version = "1.6.0"
summary = "A tool that automatically formats Python code to conform to the PEP 8 style guide"
dependencies = [
"pycodestyle>=2.8.0",
"toml",
]
[[package]] [[package]]
name = "bandit" name = "bandit"
version = "1.7.2" version = "1.7.2"
@@ -254,6 +263,12 @@ version = "1.11.0"
requires_python = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" requires_python = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
summary = "library with cross-python path, ini-parsing, io, code, log facilities" summary = "library with cross-python path, ini-parsing, io, code, log facilities"
[[package]]
name = "pycodestyle"
version = "2.8.0"
requires_python = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
summary = "Python style guide checker"
[[package]] [[package]]
name = "pycparser" name = "pycparser"
version = "2.21" version = "2.21"
@@ -522,7 +537,7 @@ dependencies = [
[metadata] [metadata]
lock_version = "3.1" lock_version = "3.1"
content_hash = "sha256:92d73225adbc3f8c9e16ea26f15a46a8edb985480a6ce601023aed3ed5336f05" content_hash = "sha256:774c08638da83171a24511eb8eecb055bc0b09bd5b38263118dd8ac32b842bdd"
[metadata.files] [metadata.files]
"altgraph 0.17.2" = [ "altgraph 0.17.2" = [
@@ -545,6 +560,10 @@ content_hash = "sha256:92d73225adbc3f8c9e16ea26f15a46a8edb985480a6ce601023aed3ed
{file = "attrs-21.4.0-py2.py3-none-any.whl", hash = "sha256:2d27e3784d7a565d36ab851fe94887c5eccd6a463168875832a1be79c82828b4"}, {file = "attrs-21.4.0-py2.py3-none-any.whl", hash = "sha256:2d27e3784d7a565d36ab851fe94887c5eccd6a463168875832a1be79c82828b4"},
{file = "attrs-21.4.0.tar.gz", hash = "sha256:626ba8234211db98e869df76230a137c4c40a12d72445c45d5f5b716f076e2fd"}, {file = "attrs-21.4.0.tar.gz", hash = "sha256:626ba8234211db98e869df76230a137c4c40a12d72445c45d5f5b716f076e2fd"},
] ]
"autopep8 1.6.0" = [
{file = "autopep8-1.6.0-py2.py3-none-any.whl", hash = "sha256:ed77137193bbac52d029a52c59bec1b0629b5a186c495f1eb21b126ac466083f"},
{file = "autopep8-1.6.0.tar.gz", hash = "sha256:44f0932855039d2c15c4510d6df665e4730f2b8582704fa48f9c55bd3e17d979"},
]
"bandit 1.7.2" = [ "bandit 1.7.2" = [
{file = "bandit-1.7.2-py3-none-any.whl", hash = "sha256:e20402cadfd126d85b68ed4c8862959663c8c372dbbb1fca8f8e2c9f55a067ec"}, {file = "bandit-1.7.2-py3-none-any.whl", hash = "sha256:e20402cadfd126d85b68ed4c8862959663c8c372dbbb1fca8f8e2c9f55a067ec"},
{file = "bandit-1.7.2.tar.gz", hash = "sha256:6d11adea0214a43813887bfe71a377b5a9955e4c826c8ffd341b494e3ab25260"}, {file = "bandit-1.7.2.tar.gz", hash = "sha256:6d11adea0214a43813887bfe71a377b5a9955e4c826c8ffd341b494e3ab25260"},
@@ -816,6 +835,10 @@ content_hash = "sha256:92d73225adbc3f8c9e16ea26f15a46a8edb985480a6ce601023aed3ed
{file = "py-1.11.0-py2.py3-none-any.whl", hash = "sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378"}, {file = "py-1.11.0-py2.py3-none-any.whl", hash = "sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378"},
{file = "py-1.11.0.tar.gz", hash = "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719"}, {file = "py-1.11.0.tar.gz", hash = "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719"},
] ]
"pycodestyle 2.8.0" = [
{file = "pycodestyle-2.8.0-py2.py3-none-any.whl", hash = "sha256:720f8b39dde8b293825e7ff02c475f3077124006db4f440dcbc9a20b76548a20"},
{file = "pycodestyle-2.8.0.tar.gz", hash = "sha256:eddd5847ef438ea1c7870ca7eb78a9d47ce0cdb4851a5523949f2601d0cbbe7f"},
]
"pycparser 2.21" = [ "pycparser 2.21" = [
{file = "pycparser-2.21-py2.py3-none-any.whl", hash = "sha256:8ee45429555515e1f6b185e78100aea234072576aa43ab53aefcae078162fca9"}, {file = "pycparser-2.21-py2.py3-none-any.whl", hash = "sha256:8ee45429555515e1f6b185e78100aea234072576aa43ab53aefcae078162fca9"},
{file = "pycparser-2.21.tar.gz", hash = "sha256:e644fdec12f7872f86c58ff790da456218b10f863970249516d60a5eaca77206"}, {file = "pycparser-2.21.tar.gz", hash = "sha256:e644fdec12f7872f86c58ff790da456218b10f863970249516d60a5eaca77206"},

View File

@@ -32,7 +32,8 @@ dependencies = [
"pywin32==303; sys_platform == 'win32'", "pywin32==303; sys_platform == 'win32'",
"selenium~=4.1", "selenium~=4.1",
"selenium_stealth~=1.0", "selenium_stealth~=1.0",
"webdriver_manager~=3.5"] "webdriver_manager~=3.5"
]
[project.urls] [project.urls]
homepage = "https://github.com/Second-Hand-Friends/kleinanzeigen-bot" homepage = "https://github.com/Second-Hand-Friends/kleinanzeigen-bot"
@@ -56,6 +57,7 @@ version = {use_scm = true}
[tool.pdm.dev-dependencies] [tool.pdm.dev-dependencies]
dev = [ dev = [
"autopep8~=1.6.0",
"bandit~=1.7", "bandit~=1.7",
"pytest~=6.2", "pytest~=6.2",
"pyinstaller~=4.8", "pyinstaller~=4.8",
@@ -67,19 +69,40 @@ dev = [
[tool.pdm.scripts] [tool.pdm.scripts]
app = "python -m kleinanzeigen_bot" app = "python -m kleinanzeigen_bot"
compile = "python -O -m PyInstaller pyinstaller.spec --clean" compile = "python -O -m PyInstaller pyinstaller.spec --clean"
format = "autopep8 --recursive --in-place kleinanzeigen_bot tests"
lint = "pylint kleinanzeigen_bot" lint = "pylint kleinanzeigen_bot"
scan = "bandit -c pyproject.toml -r kleinanzeigen_bot" scan = "bandit -c pyproject.toml -r kleinanzeigen_bot"
test = "python -m pytest -v" test = "python -m pytest -v"
##################### #####################
# bandit https://github.com/PyCQA/bandit # autopep8
# https://pypi.org/project/autopep8/
# https://github.com/hhatto/autopep8
#####################
[tool.autopep8]
max_line_length = 160
ignore = [ # https://github.com/hhatto/autopep8#features
"E124", # Don't change indention of multi-line statements
"E128", # Don't change indention of multi-line statements
"E231", # Don't add whitespace after colon (:) on type declaration
"E251", # Don't remove whitespace around parameter '=' sign.
"E401" # Don't put imports on separate lines
]
aggressive = 3
#####################
# bandit
# https://pypi.org/project/bandit/
# https://github.com/PyCQA/bandit
##################### #####################
[tool.bandit] [tool.bandit]
##################### #####################
# pylint # pylint
# https://pypi.org/project/pylint/
# https://github.com/PyCQA/pylint
##################### #####################
[tool.pylint.master] [tool.pylint.master]
extension-pkg-whitelist = "win32api" extension-pkg-whitelist = "win32api"
@@ -120,6 +143,7 @@ max-statements = 70
##################### #####################
# pytest # pytest
# https://pypi.org/project/pytest/
##################### #####################
[tool.pytest.ini_options] [tool.pytest.ini_options]
# https://docs.pytest.org/en/stable/reference.html#confval-addopts # https://docs.pytest.org/en/stable/reference.html#confval-addopts