This commit is contained in:
parent
a8545211e8
commit
980242404a
18
.flake8
18
.flake8
@ -1,18 +0,0 @@
|
|||||||
[flake8]
|
|
||||||
max-line-length = 100
|
|
||||||
ignore = D203, W503
|
|
||||||
per-file-ignores =
|
|
||||||
*/__init__.py: F401
|
|
||||||
exclude =
|
|
||||||
.git,
|
|
||||||
__pycache__,
|
|
||||||
docs/conf.py,
|
|
||||||
deps
|
|
||||||
old,
|
|
||||||
build,
|
|
||||||
dist,
|
|
||||||
venv
|
|
||||||
max-complexity = 10
|
|
||||||
extend-ignore =
|
|
||||||
# See https://github.com/PyCQA/pycodestyle/issues/373
|
|
||||||
E203,
|
|
@ -84,19 +84,19 @@ pip install -r requirements.txt
|
|||||||
Can be used to quickly check validity of script. Install `flake8` first
|
Can be used to quickly check validity of script. Install `flake8` first
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
python3 -m pip install flake8
|
python3 -m pip install ruff
|
||||||
```
|
```
|
||||||
|
|
||||||
or on Windows
|
or on Windows
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
py -m pip install flake8
|
py -m pip install ruff
|
||||||
```
|
```
|
||||||
|
|
||||||
and then run the `lint.py` script
|
and then run it
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./lint.py
|
ruff .
|
||||||
```
|
```
|
||||||
|
|
||||||
# Run Auto-Formatter
|
# Run Auto-Formatter
|
||||||
|
42
lint.py
42
lint.py
@ -1,42 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
exclude_dirs_flag = ""
|
|
||||||
if not os.path.exists("setup.cfg"):
|
|
||||||
exclude_dirs_flag = (
|
|
||||||
"--exclude .git,__pycache__,docs/conf.py,old,build,dist,venv"
|
|
||||||
)
|
|
||||||
additional_flags_both_steps = "--count --statistics"
|
|
||||||
additional_flags_first_step = "--select=E9,F63,F7,F82 --show-source"
|
|
||||||
python_exe = ""
|
|
||||||
if os.name == "nt":
|
|
||||||
python_exe = "py -m"
|
|
||||||
flake8_first_step_cmd = (
|
|
||||||
f"{python_exe} flake8 . {additional_flags_both_steps} "
|
|
||||||
f"{additional_flags_first_step} {exclude_dirs_flag}"
|
|
||||||
)
|
|
||||||
status = os.system(flake8_first_step_cmd)
|
|
||||||
if os.name == "nt":
|
|
||||||
if status != 0:
|
|
||||||
print(f"Flake8 linter errors with status {status}")
|
|
||||||
else:
|
|
||||||
if os.WEXITSTATUS(status) != 0:
|
|
||||||
print(f"Flake8 linter errors with status {status}")
|
|
||||||
sys.exit(0)
|
|
||||||
additional_flags_second_step = (
|
|
||||||
'--exit-zero --max-complexity=10 --per-file-ignores="__init__.py:F401"'
|
|
||||||
)
|
|
||||||
if not os.path.exists("setup.cfg"):
|
|
||||||
additional_flags_second_step += " --max-line-length=100"
|
|
||||||
flake8_second_step_cmd = (
|
|
||||||
f"{python_exe} flake8 . {additional_flags_both_steps} "
|
|
||||||
f" {additional_flags_second_step} {exclude_dirs_flag}"
|
|
||||||
)
|
|
||||||
os.system(flake8_second_step_cmd)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
@ -43,3 +43,8 @@ include-package-data = true
|
|||||||
# Auto-Discovery is problematic for some reason, so use custom-discovery
|
# Auto-Discovery is problematic for some reason, so use custom-discovery
|
||||||
[tool.setuptools.packages]
|
[tool.setuptools.packages]
|
||||||
find = {}
|
find = {}
|
||||||
|
|
||||||
|
[tool.ruff]
|
||||||
|
ignore = ["E501"]
|
||||||
|
[tool.ruff.extend-per-file-ignores]
|
||||||
|
"__init__.py" = ["F401"]
|
||||||
|
@ -7,7 +7,7 @@ Checklist for new releases
|
|||||||
2. Update `CHANGELOG.md`: Convert `unreleased` section into version section
|
2. Update `CHANGELOG.md`: Convert `unreleased` section into version section
|
||||||
with date and new `unreleased`section.
|
with date and new `unreleased`section.
|
||||||
3. Run auto-formatter with `black .`
|
3. Run auto-formatter with `black .`
|
||||||
4. Run linter with `flake8 .`
|
4. Run linter with `ruff .`
|
||||||
|
|
||||||
# Post-Release
|
# Post-Release
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user