Questions tagged [pyflakes]

Pyflakes analyzes Python source code non-intrusively to check for errors.

Pyflakes analyzes Python source code non-intrusively to check for errors.

Similar to the C language source code analyzer lint, Pyflakes performs similar function on Python source code. It can be used to check for simple errors like misplaced quotes, code indentation inconsistencies, syntax errors, referenced but undeclared variables, unused imported modules, etc. A very useful tool for any Python developer's toolkit!

See also:

83 questions
8
votes
3 answers

How would I start integrating pyflakes with Hudson

We use Hudson for continuous integration with the Violations Plugin which parses our output from pylint. However, pylint is a bit too strict, and hard to configure. What we'd rather use is pyflakes which would give us the right level of "You're…
dd.
  • 922
  • 1
  • 7
  • 17
7
votes
1 answer

Idiomatic way in Python to indicate an unused module import is intentional

Sometimes a Python module import that appears to be unused, is in fact essential to the proper functioning of the program. Having seemingly unused imports gives rise to spurious messages from tools like PyFlakes, and can attract unwarranted…
Isac Casapu
  • 1,163
  • 13
  • 21
7
votes
1 answer

flake8 not reporting on lines that are too long

If I create a file test.py with the following poorly-formatted contents: import re long_string = "foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo" class Foo(): pass and run flake8 on the file from the…
elethan
  • 16,408
  • 8
  • 64
  • 87
6
votes
4 answers

pylint bug - E1101 & E0102 upon use of @property + @foo.setter

I noticed pylint doesn't handle well the case of: @property def foo(self): return self._bar.foo @foo.setter def foo(self, foo_val): self._bar.foo = foo_val Though it's a perfectly valid case syntax since python2.6 It says I defined foo…
yonix
  • 11,665
  • 7
  • 34
  • 52
5
votes
4 answers

Can flymake's temporary file be created in the system's temporary directory?

I am currently using the following code to hook up flymake and Pyflakes in emacs: (defun flymake-create-temp-in-system-tempdir (filename prefix) (make-temp-file (or prefix "flymake"))) and then I pass this function to…
Ryan Kaskel
  • 4,744
  • 1
  • 19
  • 18
5
votes
1 answer

pep8 warn about 8-space indent

This bit of code: def foo(): print("hello") violates PEP 0008, which states Use 4 spaces per indentation level. But neither the pep8, pyflakes, or flake8 commands warn about it. How can I get one of them to complain about this unpythonic…
andrewdotn
  • 32,721
  • 10
  • 101
  • 130
5
votes
1 answer

Is there a plugin for pylint and pyflakes for nose tests?

I wonder if there is a nose plugin for pylint and/or pyflakes? Currently I am using coverage and tissue (PEP8) plugins for nose tests. Tnx in advance
brodul
  • 256
  • 2
  • 5
4
votes
2 answers

How to make Vim error list permanent using PyFlakes?

I want to use pep8 as my makeprg in order to check and fix my code compliance to PEP8 (Style guide for python code). I used the command :set makeprg=pep8\ --repeat\ %, and when I do :make it works, the error list is populated and I can use :cn, :cp…
Andrea Spadaccini
  • 12,378
  • 5
  • 40
  • 54
4
votes
1 answer

Pylint doesn't detect an undefined variable in an 'else' clause

I have the following python code a = 2 if a == 1: b = 'blah' print b else: print b When I try to run it, I get a runtime error since 'b' is only defined in the 'if' clause, not the 'else'. Pylint and Pyflakes both failed to detect this…
freakazoid
  • 69
  • 7
4
votes
1 answer

Any python linter to warn var shadow argument

pylint(1.5.2) says "Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)", this is absolutely not the case. Any lint tool to warn about this? #!/usr/bin/env python2 # -*- coding: utf-8 -*- '''test module''' def test_fn(var_arg): …
schemacs
  • 2,783
  • 8
  • 35
  • 53
4
votes
2 answers

How to run the flake8 in circle.yml

I am getting the following error when building circle ci server. bash: line 1: flake8: command not found flake8 app/ returned exit code 127
Seenu S
  • 3,381
  • 6
  • 30
  • 45
4
votes
3 answers

How can I get pyflakes to run on Windows?

Having trouble getting pyflakes to run on windows. On Windows there is no apt install , so... what to do?
Cheeso
  • 189,189
  • 101
  • 473
  • 713
3
votes
0 answers

Tell flake8 to ignore a few consecutive lines

I'm writing a game which involves a predefined table that looks like this: SCORES = [ [ 1, 123, 0, 456], [ 78, 90, -1, 234], [ 567, 8, 90, 12], [ 3, 4, 567, 890] ] To no one's surprise, flake8 gets angry about it. I…
iBug
  • 35,554
  • 7
  • 89
  • 134
3
votes
4 answers

How to suppress a certain warning in Spyder editor?

The editor in Spyder always gives me warnings for unused imports/variables immediately after I type the line. I want to suppress such warnings. How do I do that? And I want this to happen for every file I open in the Spyder editor, wouldn't prefer…
HMK
  • 578
  • 2
  • 9
  • 24
3
votes
2 answers

Problem with pyflakes in emacs on Windows

I followed this link here to try and set up emacs for python dev on windows. Although everything seems fine, pyflakes is creating problems and not giving me the syntax checking. Everytime I open a '.py' file, I get the error "Failed to launch syntax…
Abhi
  • 161
  • 1
  • 8