Last active
November 2, 2021 11:07
-
-
Save canassa/aabb89290bf38c3040db2cfce1e82fcf to your computer and use it in GitHub Desktop.
A handpicked pylint configuration for Django projects
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
[tool.pylint.master] | |
# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the | |
# number of processors available to use. | |
# Note: You have to experiment with this number, in noticed that starting too many | |
# jobs can slow down Pylint | |
jobs = 4 | |
# Add files or directories matching the regex patterns to the ignore-list. The | |
# regex matches against paths. | |
ignore-paths = [".*/migrations", "src/config/settings"] | |
# Disable the message, report, category or checker with the given id(s). | |
disable = "all" | |
# It's a good idea to run Pylint with all checkers enabled from time to | |
# time to see if you are missing any useful checkers. | |
# In order to do that comment the "all" and uncomment the list below. | |
#disable = [ | |
# "abstract-method", | |
# "arguments-differ", | |
# "arguments-renamed", | |
# "broad-except", | |
# "duplicate-code", | |
# "fixme", | |
# "import-outside-toplevel", | |
# "invalid-str-returned", | |
# "line-too-long", | |
# "logging-fstring-interpolation", | |
# "method-hidde", | |
# "method-hidden", | |
# "missing-class-docstring", | |
# "missing-function-docstring", | |
# "missing-module-docstring", | |
# "no-member", | |
# "no-name-in-module", | |
# "no-self-use", | |
# "protected-access", | |
# "too-few-public-methods", | |
# "too-many-ancestors", | |
# "too-many-arguments", | |
# "too-many-branches", | |
# "too-many-instance-attributes", | |
# "too-many-lines", | |
# "too-many-locals", | |
# "too-many-nested-blocks", | |
# "too-many-public-methods", | |
# "too-many-return-statements", | |
# "too-many-statements", | |
# "ungrouped-imports", | |
# "unsubscriptable-object", | |
# "unused-argument", | |
#] | |
# Enable the message, report, category or checker with the given id(s). | |
# From: https://pylint.pycqa.org/en/latest/technical_reference/features.html | |
enable = [ | |
# Stdlib checker Messages | |
"forgotten-debug-statement", | |
"deprecated-method", | |
"unspecified-encoding", | |
# Basic checker Message | |
"invalid-name", | |
"misplaced-comparison-constant", | |
"unreachable", | |
"dangerous-default-value", | |
"pointless-statement", | |
"pointless-string-statement", | |
"unnecessary-pass", | |
"unnecessary-lambda", | |
"duplicate-key", | |
"useless-else-on-loop", | |
"comparison-with-callable", | |
"function-redefined", | |
"self-assigning-variable", | |
# Refactoring Checker Messages | |
"consider-using-f-string", | |
"inconsistent-return-statements", | |
"no-else-break", | |
"no-else-raise", | |
"no-else-return", | |
"redefined-argument-from-local", | |
"super-with-arguments", | |
"try-except-raise", | |
"unnecessary-comprehension", | |
"use-a-generator", | |
"use-dict-literal", | |
"useless-return", | |
# Exceptions checker Messages | |
"raise-missing-from", | |
# Variables checker Messages | |
"undefined-all-variable", | |
"possibly-unused-variable", | |
"unused-variable", | |
"unused-import", | |
"redefined-outer-name", | |
"redefined-builtin", | |
"undefined-loop-variable", | |
# Imports checker Messages | |
"import-error", | |
"import-self", | |
] | |
# Add the subdirectoy to the path | |
# https://stackoverflow.com/a/39207275/360829 | |
init-hook = """ | |
from pathlib import Path | |
import sys | |
sys.path.append(str(Path('.').resolve()))""" | |
[tool.pylint.basic] | |
# Good variable names regexes, separated by a comma. If names match any regex, | |
# they will always be accepted | |
# By default, Pylint doesn't like one or two letters variables (like 'pk'), this removes that | |
good-names-rgxs = ["^[_a-z][_a-z0-9]?$"] | |
# Regular expression matching correct class names. Overrides class-naming-style. | |
# This allows for single letter classes, which is necessary for TypeVars | |
# https://github.com/PyCQA/pylint/issues/3401 | |
class-rgx = "^[A-Z][a-zA-Z0-9]*$" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment