Created
July 24, 2025 13:34
-
-
Save serjflint/9117982ebdf1a3b9d3c9eaee9bef5290 to your computer and use it in GitHub Desktop.
Get pylint rules available in ruff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import subprocess | |
| pipeline = [ | |
| 'curl https://api.github.com/repos/astral-sh/ruff/issues/970', | |
| 'jq -r .body', | |
| "grep -F '[x]'", | |
| "grep -v '\~'", | |
| ] | |
| cmd = " | ".join(pipeline) | |
| available = {} | |
| output = subprocess.check_output(cmd, shell=True, text=True) | |
| for line in output.splitlines(): | |
| line = line[6:].strip('`') | |
| try: | |
| rule = line.split()[0].strip('\` ') | |
| code = ''.join(line.split()[3:]).strip('()\` ') | |
| except ValueError as err: | |
| pass | |
| available[rule] = code | |
| overlap = """ | |
| abstract-method | |
| abstract-class-instantiated | |
| arguments-differ | |
| assigning-non-slot | |
| assignment-from-no-return | |
| assignment-from-none | |
| bad-exception-cause | |
| bad-format-character | |
| bad-reversed-sequence | |
| bad-super-call | |
| bad-thread-instantiation | |
| catching-non-exception | |
| comparison-with-callable | |
| deprecated-class | |
| dict-iter-missing-items | |
| format-combined-specification | |
| global-variable-undefined | |
| import-error | |
| inconsistent-mro | |
| inherit-non-class | |
| init-is-generator | |
| invalid-class-object | |
| invalid-enum-extension | |
| invalid-envvar-value | |
| invalid-format-returned | |
| invalid-hash-returned | |
| invalid-metaclass | |
| invalid-overridden-method | |
| invalid-repr-returned | |
| invalid-sequence-index | |
| invalid-slice-index | |
| invalid-slots-object | |
| invalid-slots | |
| invalid-star-assignment-target | |
| invalid-str-returned | |
| invalid-unary-operand-type | |
| invalid-unicode-codec | |
| isinstance-second-argument-not-valid-type | |
| method-hidden | |
| misplaced-format-function | |
| missing-format-argument-key | |
| missing-format-attribute | |
| missing-kwoa | |
| missing-type-doc | |
| missing-yield-type-doc | |
| no-member | |
| no-value-for-parameter | |
| non-iterator-returned | |
| non-str-assignment-to-dunder-name | |
| nonlocal-and-global | |
| not-a-mapping | |
| not-an-iterable | |
| not-async-context-manager | |
| not-callable | |
| not-context-manager | |
| overridden-final-method | |
| raising-bad-type | |
| raising-non-exception | |
| redefined-variable-type | |
| redundant-keyword-arg | |
| relative-beyond-top-level | |
| self-cls-assignment | |
| signature-differs | |
| star-needs-assignment-target | |
| subclassed-final-class | |
| super-without-brackets | |
| too-many-function-args | |
| typevar-double-variance | |
| typevar-name-mismatch | |
| unbalanced-dict-unpacking | |
| unbalanced-tuple-unpacking | |
| unexpected-keyword-arg | |
| unhashable-member | |
| unpacking-non-sequence | |
| unsubscriptable-object | |
| unsupported-assignment-operation | |
| unsupported-binary-operation | |
| unsupported-delete-operation | |
| unsupported-membership-test | |
| used-before-assignment | |
| using-final-decorator-in-unsupported-version | |
| wrong-exception-operation | |
| deprecated-argument | |
| invalid-character-carriage-return | |
| invalid-characters-in-docstring | |
| boolean-datetime | |
| return-arg-in-generator | |
| unknown-option-value | |
| using-f-string-in-unsupported-version | |
| """.strip().splitlines() | |
| res = set(available) - set(overlap) | |
| for idx, rule in enumerate(sorted(res)): | |
| code = available[rule] | |
| print(f"{idx+1}. {rule} (code: {code})") | |
| # print(code) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment