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
10
votes
2 answers

Django forms.ModelForm, Pylint, and new/old style classes

I have a Django 1.5 form that looks like this (simplified): class BidForm(forms.ModelForm): class Meta: fields = ( ) model = Bid def __init__(self, *args, **kwargs): super(BidForm, self).__init__(*args,…
Erik
  • 7,479
  • 8
  • 62
  • 99
10
votes
3 answers

Setting up default pylint config.rc file in Windows

I'm using Pylint under Windows, and it's not reading my pylint-config.rc file. Is there a way to set up a default .rc file for Python within windows so that I don't have to keep typing it into the command line? Thanks.
brentlance
  • 2,189
  • 1
  • 19
  • 25
9
votes
1 answer

Pylint E0202 False Positive? Or is this piece of code wrong?

I've been working on a class with properties but we ran into a nasty problem with pylint (0.25.1) In the code below we are defining a class with a property which were introduced in python 2.6 However, pylint whines about the fact that in the…
Daan Timmer
  • 14,771
  • 6
  • 34
  • 66
9
votes
4 answers

_shutdown AttributeError (ignored) when linting code that uses M2Crypto

I'm running lint as follows: $ python -m pylint.lint m2test.py with this code: import M2Crypto def f(): M2Crypto.RSA.new_pub_key("").as_pem(cipher=None).split("\n") The lint output ends with: Exception AttributeError: '_shutdown' in
Tony Meyer
  • 10,079
  • 6
  • 41
  • 47
9
votes
2 answers

Pylint - distinguish new errors from old ones

Does anybody know how to distinguish new errors (those that were found during latest Pylint execution) and old errors (those that were alredy found during previous executions) in the Pylint report? I'm using Pylint in one of my projects, and the…
Tim
  • 12,318
  • 7
  • 50
  • 72
9
votes
2 answers

How to disable pylint inspections for anything that uses my function?

I've made a classproperty descriptor and whenever I use a function decorated with it, I get multiple pylint inspection errors. Here is a sample class with a sample decorated function: class Bar: """ Bar documentation. """ # pylint:…
Kacperito
  • 1,277
  • 1
  • 10
  • 27
9
votes
1 answer

Python pylint(raising-format-tuple) Exception arguments suggest string formatting might be intended

With a simple custom exception class defined as: class MyError(Exception): pass And this call: foo = 'Some more info' raise MyError("%s: there was an error", foo) pylint gives: Exception arguments suggest string formatting might be intended…
Salvatore
  • 10,815
  • 4
  • 31
  • 69
9
votes
3 answers

Running pre-commit hooks (e.g. pylint) when developing with docker

pre-commit hooks are run in a separate virtual environment (or Docker container). However our code is running on Docker and we're also developing using Docker. Up until now we didn't have to install any dependencies on our host systems, but when…
Jann
  • 1,799
  • 3
  • 21
  • 38
9
votes
2 answers

Handling PyLint Warning of Inconsistent Return Statement

I'm running PyLint on some code and I'm getting the warning of "Either all return statements in a function should return an expression or none of them should. (inconsistent-return-statements)." Here is the code I have: def…
Jeff Nyman
  • 870
  • 2
  • 12
  • 31
9
votes
1 answer

How to accept additional parameter in subclass? (Without pylint's arguments-differ)

I have a base class that represents the state of a game and provides a perform_move method: class GameState: # other code def perform_move(self, position: LinePosition) -> MoveResult: # more code Now I want to create a subclass of GameState…
GitProphet
  • 870
  • 1
  • 12
  • 22
9
votes
1 answer

Instance of tuple has no member (pylint no-member) in enum class

I am getting the following errors from pylint when using the members "value" and "equals" from an enum class: "code": "no-member" "message": "Instance of 'tuple' has no 'value' member" Versions: pylint 2.3.1 astroid 2.2.5 Python 3.6.3 The…
Smule
  • 165
  • 2
  • 8
9
votes
1 answer

Pylint Django model instance of 'str' has no member

I am using pylint-django for my Django project and one of my models is as follows: class Registration(models.Model): date_added = models.DateTimeField(auto_now_add=True) event = models.ForeignKey(Event, on_delete=models.CASCADE) user =…
PythonSherpa
  • 2,560
  • 3
  • 19
  • 40
9
votes
3 answers

pylint, pandas : Comparison to True should be just 'expr' or 'expr is True' (singleton-comparison)

did anyone solve this pylint issue when using pandas? C:525,59: Comparison to True should be just 'expr' or 'expr is True' (singleton-comparison) this happens in the line where i'm using: df_current_dayparts_raw['is_standard'] == True I tried…
findissuefixit
  • 121
  • 2
  • 6
9
votes
1 answer

Specific class for generated-members in pylint?

I'm slightly unsure of how the generated-members of pylint works. Lets say I add the following to .pylintrc: [TYPECHECK] generated-members=commit It hides the following commit error: E1101:Instance of 'scoped_session' has no 'commit'…
TragedyStruck
  • 586
  • 8
  • 24
9
votes
2 answers

Pylint invalid function name

I'm running Pylint 1.7.2 with Python 3.6.2. Pylint is showing the following error: Invalid function name "create_maximization_option_dataframe" (invalid-name) I define a function like so in my code: def…
Shakes
  • 531
  • 1
  • 5
  • 16