[DEV] add ruff for linting and combine linters into one workflow (#1875)
* remove unused and update black + precommit * makefile add ruff remove unused * F541 fix * complete ruff ignore * remove unused workflow and combine linters into one add lnbits/static to ruff ignore save preview and linelength for later define target version for black * ignore upgrades for mypy * remove flake8 * ignore F401 for __init__ files * unused pylint comment * unused noqa * ignore upgrades for black * run linting on py3.9 and py3.10 * dont assume python
This commit is contained in:
parent
642f9a4c00
commit
eb0b06f98c
16 changed files with 218 additions and 429 deletions
105
pyproject.toml
105
pyproject.toml
|
|
@ -36,19 +36,17 @@ cashu = "0.9.0"
|
|||
slowapi = "^0.1.7"
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
flake8 = "^6.0.0"
|
||||
isort = "^5.12.0"
|
||||
pytest = "^7.1.2"
|
||||
mock = "^4.0.3"
|
||||
black = "^22.6.0"
|
||||
black = "^23.7.0"
|
||||
pytest-asyncio = "^0.19.0"
|
||||
pytest-cov = "^4.1.0"
|
||||
mypy = "^0.971"
|
||||
types-protobuf = "^3.19.22"
|
||||
pylint = "^2.17.2"
|
||||
pre-commit = "^3.2.2"
|
||||
types-mock = "^5.0.0.6"
|
||||
openapi-spec-validator = "^0.5.5"
|
||||
ruff = "^0.0.284"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core>=1.0.0"]
|
||||
|
|
@ -57,9 +55,6 @@ build-backend = "poetry.core.masonry.api"
|
|||
[tool.poetry.scripts]
|
||||
lnbits = "lnbits.server:main"
|
||||
|
||||
[tool.isort]
|
||||
profile = "black"
|
||||
|
||||
[tool.pyright]
|
||||
include = [
|
||||
"lnbits"
|
||||
|
|
@ -75,6 +70,7 @@ files = "lnbits"
|
|||
exclude = [
|
||||
"^lnbits/wallets/lnd_grpc_files",
|
||||
"^lnbits/extensions",
|
||||
"^lnbits/upgrades",
|
||||
]
|
||||
|
||||
[[tool.mypy.overrides]]
|
||||
|
|
@ -105,35 +101,72 @@ testpaths = [
|
|||
"tests"
|
||||
]
|
||||
|
||||
[tool.pylint.'MESSAGES CONTROL']
|
||||
max-line-length = 300
|
||||
disable = "all"
|
||||
enable = [
|
||||
"assignment-from-none",
|
||||
"chained-comparison",
|
||||
"consider-merging-isinstance",
|
||||
"consider-using-dict-comprehension",
|
||||
"consider-using-dict-items",
|
||||
"consider-using-f-string",
|
||||
"consider-using-in",
|
||||
"dangerous-default-value",
|
||||
"inconsistent-return-statements",
|
||||
"lost-exception",
|
||||
"pointless-string-statement",
|
||||
"simplifiable-if-statement",
|
||||
"super-init-not-called",
|
||||
"superfluous-parens",
|
||||
"unused-variable",
|
||||
"use-list-literal",
|
||||
"useless-else-on-loop",
|
||||
"useless-object-inheritance",
|
||||
[tool.black]
|
||||
# line-length = 150
|
||||
# previously experimental-string-processing = true
|
||||
# this should autoformat string poperly but does not work
|
||||
# preview = true
|
||||
target-versions = ["py39"]
|
||||
extend-exclude = """(
|
||||
lnbits/static
|
||||
| lnbits/extensions
|
||||
| lnbits/upgrades
|
||||
| lnbits/wallets/lnd_grpc_files
|
||||
)"""
|
||||
|
||||
[tool.ruff]
|
||||
# Same as Black.
|
||||
line-length = 150
|
||||
|
||||
# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
|
||||
select = ["E", "F", "I"]
|
||||
ignore = [
|
||||
"E402", # Module level import not at top of file
|
||||
"E501", # Line length
|
||||
]
|
||||
|
||||
[tool.pylint.MASTER]
|
||||
ignore-paths = [
|
||||
"^lnbits/extensions/.*$",
|
||||
"^lnbits/upgrades/.*$",
|
||||
"^lnbits/wallets/lnd_grpc_files/.*$",
|
||||
# Allow autofix for all enabled rules (when `--fix`) is provided.
|
||||
fixable = ["ALL"]
|
||||
unfixable = []
|
||||
|
||||
# Exclude a variety of commonly ignored directories.
|
||||
exclude = [
|
||||
"lnbits/static",
|
||||
"lnbits/extensions",
|
||||
"lnbits/wallets/lnd_grpc_files",
|
||||
".bzr",
|
||||
".direnv",
|
||||
".eggs",
|
||||
".git",
|
||||
".git-rewrite",
|
||||
".hg",
|
||||
".mypy_cache",
|
||||
".nox",
|
||||
".pants.d",
|
||||
".pytype",
|
||||
".ruff_cache",
|
||||
".svn",
|
||||
".tox",
|
||||
".venv",
|
||||
"__pypackages__",
|
||||
"_build",
|
||||
"buck-out",
|
||||
"build",
|
||||
"dist",
|
||||
"node_modules",
|
||||
"venv",
|
||||
]
|
||||
fail-under = 10.0
|
||||
jobs = 0
|
||||
|
||||
# Allow unused variables when underscore-prefixed.
|
||||
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
|
||||
|
||||
# Assume Python
|
||||
# target-version = "py39"
|
||||
|
||||
# Ignore unused imports in __init__.py files.
|
||||
[tool.ruff.extend-per-file-ignores]
|
||||
"__init__.py" = ["F401", "F403"]
|
||||
|
||||
[tool.ruff.mccabe]
|
||||
# Unlike Flake8, default to a complexity level of 10.
|
||||
max-complexity = 10
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue