Questions tagged [pylint]

Pylint is a Python source code analyzer looking for bugs and signs of poor quality.

Pylint is a Python tool that checks if a module satisfies a coding standard.

1691 questions
11
votes
2 answers

Specify typing for Django field in model (for Pylint)

I have created custom Django model-field subclasses based on CharField but which use to_python() to ensure that the model objects returned have more complex objects (some are lists, some are dicts with a specific format, etc.) -- I'm using MySQL so…
11
votes
2 answers

Getting pylint warning: "No config file found, using default configuration"

$ pylint --reports=n main.py Output: No config file found, using default configuration
kamal
  • 9,637
  • 30
  • 101
  • 168
11
votes
2 answers

pip installed pylint cannot be found

There's a lot of questions around this, so it might be a duplicate, but I can't find a solution, so here goes.. I want to use pylint with atom. If I use the recommended pip install --user pylint it seems to work but atom can't find and neither can…
jorgen
  • 3,425
  • 4
  • 31
  • 53
11
votes
2 answers

Pylint message about module length reasoning and ratio of docstrings to lines of code

I know that this could be dismissed as opinion-based, but googling isn't finding the resources I was hoping for, and I am looking for links to any established and agreed best practices in the Python community. I am an intermediate Python programmer…
moink
  • 798
  • 8
  • 20
11
votes
2 answers

Pylint ungrouped-imports warning

In my python script - youdao.py, in order to be compatible with python2 and python3, I import urlopen like this style: try: # compatible for python2 from urllib import urlencode from urllib2 import urlopen except ImportError: #…
慕冬亮
  • 339
  • 1
  • 2
  • 10
11
votes
3 answers

Python script should end with new line or not ? Pylint contradicting itself?

I am new to Pylint, and when I run it against my script, I get this output: C: 50, 0: Trailing newlines (trailing-newlines) Here, Pylint is saying that it is bad to have a final newline. I like to have a new line at the end of my scripts, so I…
Prem
  • 460
  • 1
  • 7
  • 15
11
votes
1 answer

trouble getting pylint to find inherited methods in pylons/SA models

I have a Pylons app that I'm using SqlAlchemy declarative models for. In order to make the code a bit cleaner I add a .query onto the SA Base and inherit all my models from that. So in my app.model.meta I have Base = declarative_base() metadata =…
Rick
  • 15,484
  • 5
  • 25
  • 29
11
votes
2 answers

Why does Pylint give error E0702, raising NoneType, on this raise statement?

Say I have the following code. def foo(): foobar = None if foobar is not None: raise foobar When I run this code through pylint, I get the following error: E0702:4:foo: Raising NoneType while only classes, instances or string are…
wich
  • 16,709
  • 6
  • 47
  • 72
11
votes
1 answer

Pylint: "locally defined disables" still give warnings. How to suppress them?

I work with a software framework which has a couple of classes with method names containing capital letters (due to C++ wrappers). This is of course not PEP8 and pylint shows the corresponding error C0103. I also added C0111 to the list to ignore…
tamasgal
  • 24,826
  • 18
  • 96
  • 135
11
votes
3 answers

pylint false positive for unused argument

I'm in the process of cleaning up code with pylint in order to be able to use it for pre-commit validation. I have a lot of "unused-argument" warning when in fact they are used. Here is an example triggering a false positive. def addSeven(foo):…
Rudy Bunel
  • 784
  • 1
  • 7
  • 15
11
votes
4 answers

Should namedtuples follow constant name conventions in python?

I've written a small python module where I use a couple of namedtuples to pass info around because I find them very expressive. I considered these types and named them following the PEP8 convention for class names (CamelCased). However pylint sees…
Luis
  • 859
  • 2
  • 9
  • 20
11
votes
2 answers

How to prevent python pylint complaining about socket class sendall method

I have a bit of code using a simple tcp socket setup to test something. We run pylint --errors-only on our python files, generally as a way to validate all our code. However, the simple example code given on the python socket library documentation -…
Danny Staple
  • 7,101
  • 4
  • 43
  • 56
10
votes
3 answers

python code convention using pylint

I'm trying out pylint to check my source code for conventions. Somehow some variable names are matched with the regex for constants (const-rgx) instead of the variable name regex (variable-rgx). How to match the variable name with variable-rgx? Or…
Jack Ha
  • 19,661
  • 11
  • 37
  • 41
10
votes
1 answer

Consider explicitly re-raising using the 'from' keyword pylint suggestion

I have a small python code in which I am using exception handling. def handler(event): try: client = boto3.client('dynamodb') response = client.scan(TableName=os.environ["datapipeline_table"]) return response except…
ashakshan
  • 419
  • 1
  • 5
  • 17
10
votes
3 answers

VS Code pylint(import-error) "Unable to import" subsub-module from custom directory

I have organized my self-written Python scripts within a tree of several sub-directories, starting from the parent directory "Scripts" which is already included in "python.autoComplete.extraPaths" within the…
Andreas L.
  • 3,239
  • 5
  • 26
  • 65