A little note writing.
When you want to make settings such as "Exclude some warnings from the check target" in each of Organize how to write and place the configuration file.
Reference: [Python] Create pep8 and pylint configuration files to hide some warnings --dackdive's blog The information of flake8 is added to the above blog article.
In either case, the configuration file should be created under the ~ / .config / directory. (There are other options)
The file name is
pep8pylintrcflake8And pay attention only to pylint. The format of the configuration file is also different only for pylint.
http://pep8.readthedocs.org/en/latest/intro.html#configuration according to,
If on Windows:
~\.pep8Otherwise, if theXDG_CONFIG_HOMEenvironment variable is defined:XDG_CONFIG_HOME/pep8Else ifXDG_CONFIG_HOMEis not defined:~/.config/pep8
So if you have a Mac that doesn't have XDG_CONFIG_HOME set
~/.config/pep8
Looks good.
Also at http://pep8.readthedocs.org/en/latest/intro.html#configuration,
~/.config/pep8
[pep8]
ignore = E226,E302,E41
max-line-length = 160
After ʻignore =`, write the code of the warning you want to ignore, separated by commas.
Check the code here. http://pep8.readthedocs.org/en/latest/intro.html#error-codes
https://pylint.readthedocs.io/en/latest/user_guide/run.html#command-line-options According to the pylint configuration file, the first one found is read by searching in the following order.
pylintrcin the current working directory
.pylintrc in the current working directorypylintrc file. This allows you to specify coding standards on a module-by-module basis. Of course, a directory is judged to be a Python module if it contains an __init__.py file.PYLINTRC/root:
.pylintrc in your home directory.config/pylintrc in your home directory/etc/pylintrcRoughly translated into Japanese
pylintrc in the current working directory.pylintrc in the current working directory__init__.py exists), go up the hierarchy until you find pylintrc.
This allows you to set pylintrc on a per-module basis (and modules without files can use pylintrc at the root of the project).PYLINTRC/ root:.pylintrc directly under the home directory
2. $HOME/.config/pylintrc/etc/pylintrcWhat a place, such as.
The working directory will probably be the location when you run the pylint command.
I like to put it under the ~ / .config directory like pep8
~/.config/pylintrc
It was made.
If you execute pylint with the --generate-rcfile option, the template of the configuration file will be output, so save it in an appropriate file.
$ pylint --generate-rcfile > ~/.config/pylintrc
In the generated pylintrc file, there is a variable calleddisable =, so write the warning code you want to ignore there.
~/.config/pylintrc
# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifiers separated by comma (,) or put this
# option multiple times (only on the command line, not in the configuration
# file where it should appear only once).You can also use "--disable=all" to
# disable everything first and then reenable specific checks. For example, if
# you want to run only the similarities checker, you can use "--disable=all
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
disable=
oct-method,
ext-method-called,
C0111
You can find the code here. http://pylint-messages.wikidot.com/all-codes
Also, instead of the code, it seems that you can specify a name called symbolic name, which can be guessed more than the code.
(The above are ʻoct-method and ʻext-method-called)
http://docs.pylint.org/faq.html#do-i-have-to-remember-all-these-numbers
The symbolic name can be found from here based on the code. http://docs.pylint.org/features.html#
Also, as far as I've tried it, the code (or symbolic name) seems to be fine to separate with line breaks.
http://flake8.readthedocs.org/en/latest/config.html According to non-Windows
~/.config/flake8
is. (For Windows ~ / .flake8)
Also, if there is a file called tox.ini or setup.cfg for each project
It seems that the settings described there are also automatically loaded.
(The writing method is the same as ↓)
Also according to http://flake8.readthedocs.org/en/latest/config.html
~/.config/flake8
[flake8]
ignore = E226,E302,E41
max-line-length = 160
exclude = tests/*
max-complexity = 10
And so on, it's OK in the same format as pep8.
Check the code here.
F *** series: http://flake8.readthedocs.org/en/latest/warnings.html
ʻE *** , W *** `(pep8) series: http://pep8.readthedocs.org/en/latest/intro.html#error-codes
Recommended Posts