Reputation: 78478
I will use this simple Python file for illustrating my problem:
import os
for i in range( -500, 0 ):
print i
I run Pylint on this file and get one message:
$ pylint foobar.py
************* Module foobar
W: 1, 0: Unused import os (unused-import)
Now I want to disable warning messages of the type unused-import
. But I want to add that on top of the default configuration of Pylint.
I thought this gives me the default config of Pylint, cause help of --generate-rcfile
says it generates current configuration:
$ pylint --generate-rcfile > pylintrc
When I run Pylint again on the same file, I now get a lot more messages:
************* Module foobar
C: 3, 0: No space allowed after bracket
for i in range( -500, 0 ):
^ (bad-whitespace)
C: 3, 0: No space allowed before bracket
for i in range( -500, 0 ):
^ (bad-whitespace)
C: 1, 0: Missing module docstring (missing-docstring)
W: 1, 0: Unused import os (unused-import)
Why is the bad-whitespace
message getting triggered only after the pylintrc was generated? Is bad-whitespace
disabled by default? How do I get the actual default config of pylint?
So, if the --generate-rcfile
is not giving me the default config, what is the config options it outputs? How do I get the default config of Pylint in the pylintrc format? So that I can add my settings on top of that.
Upvotes: 6
Views: 10843
Reputation: 89926
Note that the documentation for --generate-rcfile
(from pylint --help
) states:
--generate-rcfile
Generate a sample configuration file according to the current configuration. You can put other options before this one to get them in the generated configuration.
(Emphasis mine.) In other words, --generate-rc-file
depends on your existing configuration. It generates a configuration file that merges the default configuration with your existing one.
If you instead want the default, base configuration with no changes, you therefore should run it with an empty existing configuration. You can do that either by temporarily renaming ~/.pylintrc
or by running pylint --rcfile="" --generate-rcfile
.
Upvotes: 5
Reputation: 2086
I just check the pylintrc file in the source tree of the pylint project. Not sure whether they are really the default values, but appears to be pretty close.
Upvotes: 3