ssato / python-anyconfig

Python library provides common APIs to load and dump configuration files in various formats
MIT License
275 stars 31 forks source link

possible bugs pointed out by ruff #169

Open ssato opened 5 months ago

ssato commented 5 months ago

Describe the bug There are a lot of warnings and errors pointed out by ruff.

To Reproduce Steps to reproduce the behavior:

  1. run ruff, ex. ruff src/
  2. See errors and warnings

Expected behavior No errors and warnings by ruff.

Logs

ssato@localhost:~/repos/public/github.com/ssato/python-anyconfig.git$ ruff src 2>&1 | tee /tmp/t.log
warning: `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible. Ignoring `one-blank-line-before-class`.
warning: `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible. Ignoring `multi-line-summary-second-line`.
src/anyconfig/api/__init__.py:124:18: FA100 Missing `from __future__ import annotations`, but uses `typing.List`
src/anyconfig/api/_dump.py:7:15: TCH001 Move application import `.datatypes` into a type-checking block
... (snip) ...
yconfig/utils/lists.py:25:17: FA100 Missing `from __future__ import annotations`, but uses `typing.List`
src/anyconfig/utils/utils.py:9:15: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `val`
src/anyconfig/utils/utils.py:9:28: ANN002 Missing type annotation for `*_args`
src/anyconfig/utils/utils.py:9:37: ANN003 Missing type annotation for `**_kwargs`
src/anyconfig/utils/utils.py:9:49: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `noop`
src/anyconfig/utils/utils.py:20:25: FA100 Missing `from __future__ import annotations`, but uses `typing.Dict`
Found 672 errors.
[*] 4 fixable with the `--fix` option (43 hidden fixes can be enabled with the `--unsafe-fixes` option).
ssato@localhost:~/repos/public/github.com/ssato/python-anyconfig.git$ errors=$(sed -nr 's/.+[[:digit:]]+: ([A-Z][[:alnum:]]+) .*/\1/p' /tmp/t.log | sort | uniq); for e in ${errors}; do echo -ne "$e: "; grep $e /tmp/t.log | wc -l; done | sort -n -k 2 -r
FA100: 127
ANN001: 126
ANN003: 99
ANN101: 52
ANN401: 35
ANN201: 34
ANN202: 33
RUF012: 28
PGH003: 24
ARG001: 14
TRY003: 13
EM102: 12
ANN102: 10
ARG002: 6
ANN002: 6
SIM115: 5
S314: 5
PTH123: 5
BLE001: 3
UP028: 2
TCH001: 2
SIM118: 2
SIM108: 2
SIM105: 2
SIM102: 2
S608: 2
RUF005: 2
PLW2901: 2
D212: 2
B904: 2
ANN206: 2
ANN204: 2
S701: 1
S101: 1
RUF100: 1
RSE102: 1
RET501: 1
PLR2004: 1
PLR0911: 1
PGH004: 1
EM101: 1
A001: 1
ssato@localhost:~/repos/public/github.com/ssato/python-anyconfig.git$ 

Additional context (none)

ssato commented 5 months ago

Updated:

python-anyconfig.git on  change/ruff-by-default [$!?] via 🐍 v3.12.2 on ☁️  
❯ cat /tmp/t2.list 
ANN003: 101
ANN001: 97
ANN401: 42
ANN201: 25
ANN202: 14
ANN206: 2

python-anyconfig.git on  change/ruff-by-default [$!?] via 🐍 v3.12.2 on ☁️ 
❯