I am using pydev where I have set up pylint. The problem is that even inside the comments, pylint reports warnings. I was looking to disable any sort of checking inside any line or a block comment. Also, I wish to follow camelCase naming convention instead of underscores for variables and arguments in my code. Is there any way to specify such a rule without inserting my code with any pylint: disable comments?
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
As said by cfedermann, you can specify messages to be disabled in a
~/.pylintrc
file (notice you can generate a stub file usingpylint --generate-rcfile
if you don't want to use inline comments.You'll also see in the generated file, in the [BASIC] section, options like "method-rgx", "function-rgx", etc. which you can configure as you like to support camel cases style rather than pep8 underscore style.
Although this is an old question, it should be mentioned one can now specify their own regex for matching with names.
Then your regex to match camel case would be something like:
You can globally disable warnings of a certain class using
or by using a special PyLint configuration file
A sample config file is given below:
See the documentation over at Pylint's dedicated site.
Here is the custom check example, and another example easier to understand.
I was facing a problem similar to you. The following code is my solution. I customized one checker to forbidden import
datetime.now
. You can take it for reference :There are two ways I customize
pylint
.Using a config file
The first way is where you
Using a wrapper script
The second way is where you create a wrapper script that calls pylint and in the wrapper script you have a bunch of lines that look like:
Currently I am using the wrapper script approach because I want the issues to be sorted by line number and I did some shell scripting to get that sorting order.