Skip to content

Update Pylint RC file #1256

@dhermes

Description

@dhermes

@tseaver After running

pylint --generate-rcfile

I curated the output to mostly match ours and made a simple diff:

diff --git a/pylintrc_default b/pylintrc_default
index 27c4b5d..72bb922 100644
--- a/pylintrc_default
+++ b/pylintrc_default
@@ -19,9 +19,6 @@
 # pygtk.require().
 # DEFAULT: init-hook=

-# Profiled execution.
-# DEFAULT:  profile=no
-
 # Add files or directories to the blacklist. They should be base names, not
 # paths.
 # DEFAULT:  ignore=CVS
@@ -42,15 +39,33 @@ ignore =
 #            they document.
 load-plugins=pylint.extensions.check_docs

-# DEPRECATED
-# DEFAULT:  include-ids=no
+# Use multiple processes to speed up Pylint.
+jobs=1
+
+# Allow loading of arbitrary C extensions. Extensions are imported into the
+# active Python interpreter and may run arbitrary code.
+unsafe-load-any-extension=no
+
+# A comma-separated list of package or module names from where C extensions may
+# be loaded. Extensions are loading into the active Python interpreter and may
+# run arbitrary code
+extension-pkg-whitelist=

-# DEPRECATED
-# DEFAULT:  symbols=no
+# Allow optimization of some AST trees. This will activate a peephole AST
+# optimizer, which will apply various small optimizations. For instance, it can
+# be used to obtain the result of joining multiple strings with the addition
+# operator. Joining a lot of strings can lead to a maximum recursion error in
+# Pylint and this flag can prevent that. It has one side effect, the resulting
+# AST will be different than the one from reality.
+optimize-ast=no


 [MESSAGES CONTROL]

+# Only show warnings with the listed confidence levels. Leave empty to show
+# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED
+confidence=
+
 # Enable the message, report, category or checker with the given id(s). You can
 # either give multiple identifier separated by comma (,) or put this option
 # multiple time. See also the "--disable" option for examples.
@@ -120,13 +135,9 @@ reports=no
 # (RP0004).
 # DEFAULT:  evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)

-# Add a comment according to your evaluation note. This is used by the global
-# evaluation report (RP0004).
-# DEFAULT:  comment=no
-
 # Template used to display messages. This is a python new-style format string
 # used to format the message information. See doc for all details
-#msg-template=
+# DEFAULT:  msg-template=


 [SIMILARITIES]
@@ -157,6 +168,27 @@ reports=no
 # you should avoid to define new builtins when possible.
 # DEFAULT:  additional-builtins=

+# List of strings which can identify a callback function by name. A callback
+# name must start or end with one of those strings.
+callbacks=cb_,_cb
+
+
+[SPELLING]
+
+# Spelling dictionary name. Available dictionaries: none. To make it working
+# install python-enchant package.
+spelling-dict=
+
+# List of comma separated words that should not be checked.
+spelling-ignore-words=
+
+# A path to a file that contains private dictionary; one word per line.
+spelling-private-dict-file=
+
+# Tells whether to store unknown words to indicated private dictionary in
+# --spelling-private-dict-file option instead of raising a message.
+spelling-store-unknown-words=no
+

 [LOGGING]

@@ -168,7 +200,7 @@ reports=no
 [FORMAT]

 # Maximum number of characters on a single line.
-# DEFAULT:  max-line-length=80
+max-line-length=100

 # Regexp for a line that is allowed to be longer than the limit.
 # DEFAULT:  ignore-long-lines=^\s*(# )?<?https?://\S+>?$
@@ -198,6 +230,9 @@ max-module-lines=1500
 # Number of spaces of indent required inside a hanging or continued line.
 # DEFAULT:  indent-after-paren=4

+# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
+expected-line-ending-format=
+

 [MISCELLANEOUS]

@@ -207,15 +242,12 @@ max-module-lines=1500

 [BASIC]

-# Required attributes for module, separated by a comma
-# DEFAULT:  required-attributes=
-
 # List of builtins function names that should not be used, separated by a comma
 # DEFAULT:  bad-functions=map,filter,apply,input,file

 # Good variable names which should always be accepted, separated by a comma
 # DEFAULT:  good-names=i,j,k,ex,Run,_
-# RATIONALE:  'pb' and 'id' have well-understood meainings in the code.
+# RATIONALE:  'pb' and 'id' have well-understood meanings in the code.
 good-names = i, j, k, ex, Run, _,
              pb,
              id,
@@ -292,13 +324,19 @@ good-names = i, j, k, ex, Run, _,

 # Regular expression which should only match function or class names that do
 # not require a docstring.
-# DEFAULT:  no-docstring-rgx=__.*__
+no-docstring-rgx=^_

 # Minimum line length for functions/classes that require docstrings, shorter
 # ones are exempt.
 # DEFAULT:  docstring-min-length=-1


+[ELIF]
+
+# Maximum number of nested blocks for function / method body
+max-nested-blocks=5
+
+
 [TYPECHECK]

 # Tells whether missing members accessed in mixin class should be ignored. A
@@ -307,21 +345,19 @@ good-names = i, j, k, ex, Run, _,

 # List of module names for which member attributes should not be checked
 # (useful for modules/projects where namespaces are manipulated during runtime
-# and thus existing member attributes cannot be deduced by static analysis
+# and thus existing member attributes cannot be deduced by static analysis. It
+# supports qualified module names, as well as Unix pattern matching.
 # DEFAULT:  ignored-modules=

 # List of classes names for which member attributes should not be checked
-# (useful for classes with attributes dynamically set).
-# DEFAULT:  ignored-classes=SQLObject
-
-# When zope mode is activated, add a predefined set of Zope acquired attributes
-# to generated-members.
-# DEFAULT:  zope=no
+# (useful for classes with attributes dynamically set). This supports can work
+# with qualified names.
+ignored-classes=

 # List of members which are set dynamically and missed by pylint inference
-# system, and so shouldn't trigger E0201 when accessed. Python regular
+# system, and so shouldn't trigger E1101 when accessed. Python regular
 # expressions are accepted.
-# DEFAULT:  generated-members=REQUEST,acl_users,aq_parent
+generated-members=


 [IMPORTS]
@@ -344,10 +380,6 @@ good-names = i, j, k, ex, Run, _,

 [CLASSES]

-# List of interface methods to ignore, separated by a comma. This is used for
-# instance to not check methods defines in Zope's Interface base class.
-# DEFAULT:  ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by
-
 # List of method names used to declare (i.e. assign) instance attributes.
 # DEFAULT:  defining-attr-methods=__init__,__new__,setUp

@@ -357,6 +389,10 @@ good-names = i, j, k, ex, Run, _,
 # List of valid names for the first argument in a metaclass class method.
 # DEFAULT:  valid-metaclass-classmethod-first-arg=mcs

+# List of member names, which should be excluded from the protected access
+# warning.
+exclude-protected=_asdict,_fields,_replace,_source,_make
+

 [DESIGN]

@@ -400,6 +436,9 @@ min-public-methods=0
 # RATIONALE:  API mapping
 max-public-methods=40

+# Maximum number of boolean expressions in a if statement
+max-bool-expr=5
+

 [EXCEPTIONS]

Some things worth noting

  • the default list of disabled went from empty to include 50 things
  • max line length went from 80 to 100 (but AFAIK it's 79 in the pep8 defaults)
  • adding [MASTER].jobs to speed up execution (happy, happy)
  • a [SPELLING] section was enabled for spellcheck (via python-enchant)
  • [FORMAT].expected-line-ending-format added (so we can disallow Windows line endings)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions