Open slint opened 1 year ago
I am using for the tu-graz-library packages pylint as the analyzing tool. At the time where i made the black PR's i tried also to use pylint on the invenio packages. I think we should try it out, but it might be some work to make it working with the linter. further as i saw on the issues for ruff, there is some effort going on to add pylint errors also to ruff.
i did one test with one bigger package (invenio-rdm-records) @slint
ruff check --statistics invenio_rdm_records tests
on the root level of the package produces following statistics:50 F401 [*] `sqlalchemy` imported but unused
47 F841 [*] Local variable `dir_` is assigned to but never used
18 E501 [ ] Line too long (94 > 88 characters)
11 F541 [*] f-string without any placeholders
2 F811 [ ] Redefinition of unused `test_subjects` from line 224
1 F821 [ ] Undefined name `RDMRecordService`
1 E402 [ ] Module level import not at top of file
time: 0.011s
pylint --reports y invenio_rdm_records tests
produces following report+------------------------------------+------------+
|message id |occurrences |
+====================================+============+
|unused-argument |125 |
+------------------------------------+------------+
|invalid-name |118 |
+------------------------------------+------------+
|no-member |101 |
+------------------------------------+------------+
|redefined-outer-name |59 |
+------------------------------------+------------+
|fixme |41 |
+------------------------------------+------------+
|too-few-public-methods |37 |
+------------------------------------+------------+
|line-too-long |36 |
+------------------------------------+------------+
|use-dict-literal |34 |
+------------------------------------+------------+
|consider-using-f-string |34 |
+------------------------------------+------------+
|too-many-arguments |23 |
+------------------------------------+------------+
|unused-import |22 |
+------------------------------------+------------+
|arguments-differ |21 |
+------------------------------------+------------+
|arguments-renamed |19 |
+------------------------------------+------------+
|protected-access |17 |
+------------------------------------+------------+
|duplicate-code |12 |
+------------------------------------+------------+
|attribute-defined-outside-init |12 |
+------------------------------------+------------+
|unused-variable |11 |
+------------------------------------+------------+
|redefined-builtin |11 |
+------------------------------------+------------+
|no-else-return |11 |
+------------------------------------+------------+
|inconsistent-return-statements |11 |
+------------------------------------+------------+
|c-extension-no-member |9 |
+------------------------------------+------------+
|unnecessary-pass |7 |
+------------------------------------+------------+
|unspecified-encoding |6 |
+------------------------------------+------------+
|unidiomatic-typecheck |6 |
+------------------------------------+------------+
|raise-missing-from |6 |
+------------------------------------+------------+
|implicit-str-concat |6 |
+------------------------------------+------------+
|consider-using-sys-exit |5 |
+------------------------------------+------------+
|too-many-locals |4 |
+------------------------------------+------------+
|missing-function-docstring |4 |
+------------------------------------+------------+
|dangerous-default-value |4 |
+------------------------------------+------------+
|broad-exception-caught |4 |
+------------------------------------+------------+
|no-else-raise |3 |
+------------------------------------+------------+
|import-outside-toplevel |3 |
+------------------------------------+------------+
|expression-not-assigned |3 |
+------------------------------------+------------+
|abstract-method |3 |
+------------------------------------+------------+
|useless-object-inheritance |2 |
+------------------------------------+------------+
|super-with-arguments |2 |
+------------------------------------+------------+
|misplaced-bare-raise |2 |
+------------------------------------+------------+
|f-string-without-interpolation |2 |
+------------------------------------+------------+
|wrong-import-position |1 |
+------------------------------------+------------+
|wrong-import-order |1 |
+------------------------------------+------------+
|unnecessary-lambda |1 |
+------------------------------------+------------+
|ungrouped-imports |1 |
+------------------------------------+------------+
|unexpected-special-method-signature |1 |
+------------------------------------+------------+
|too-many-lines |1 |
+------------------------------------+------------+
|too-many-instance-attributes |1 |
+------------------------------------+------------+
|superfluous-parens |1 |
+------------------------------------+------------+
|stop-iteration-return |1 |
+------------------------------------+------------+
|pointless-statement |1 |
+------------------------------------+------------+
|missing-class-docstring |1 |
+------------------------------------+------------+
|keyword-arg-before-vararg |1 |
+------------------------------------+------------+
|function-redefined |1 |
+------------------------------------+------------+
|cyclic-import |1 |
+------------------------------------+------------+
|assignment-from-no-return |1 |
+------------------------------------+------------+
time: 27s
too-few-public-methods
is not changeable for invenio
I was also wondering if we could replace
flake8
,pycodestyle
, etc. withruff
, which is the new kid in the Python linters block:black
out of the box