dreadatour / flake8lint Goto Github PK
View Code? Open in Web Editor NEWSublime Text plugin for lint Python files
Sublime Text plugin for lint Python files
On save in ST3, the following error is reported in the console:
An exception occured when running pep8 checker: 'int' object has no attribute 'lineno'
I could not find my issue any more so I re-created it; My User Settings are empty and the Default Settings are untouched. I still get this error message that says that argparse can not be found. I removed my "Application Support..." settings completely, but no dice, so i moved them back.
Flake8Lint ERROR: Traceback (most recent call last):
Flake8Lint ERROR: File "/Users/georg/Library/Application Support/Sublime Text 3/Packages/Python Flake8 Lint/lint.py", line 205, in
Flake8Lint ERROR: import argparse
Flake8Lint ERROR: ImportError: No module named argparse
I have no idea where to look next... Thank you very much for your support!
Hi, after installing the plugin and hitting save on one of my files, I get the following error in the console:
Traceback (most recent call last):
File "./sublime_plugin.py", line 362, in run_
File "./Flake8Lint.py", line 154, in run
File "./lint.py", line 202, in lint_external
ValueError: invalid literal for int() with base 10: 'lint.py'
I'm running ST2 version 2.0.2 Build 2221 on Ubuntu 13.04.
I'm writing in Python3 and saving source with UTF8 (the default). I have already set the external interpreter as the Python3 one.
However, if I have some non-ASCII characters in source, the "problem decoding source" error will popup. While I tested my source with Flake8 standalone, nothing wrong happened.
I love the idea of lint_on_load so that I can see problems as soon as I open a file. However, command-P's "Goto Anything" opens a quick preview of files as it finds matches, and each one of those is being linted as it flickers across my screen.
Could you add a short delay to the lint_on_load process so that it doesn't trigger for a second or two?
(Sub-request: if so, could that become a general-purpose "lint every time I stop typing for 2 seconds" feature?)
I cloned the repository into my ST3 packages folder, but the following exception occurs on save:
Flake8Lint ERROR: Traceback (most recent call last):
Flake8Lint ERROR: File "C:\Users\Frazer\AppData\Roaming\Sublime Text 3\Packages\Python Flake8 Lint\lint.py", line 21, in <module>
Flake8Lint ERROR: from .monkey_patching import get_code_complexity
Flake8Lint ERROR: SystemError: Parent module '' not loaded, cannot perform relative import
SublimeLinter: python enabled (built in)
An exception occured when running pep8 checker: 'int' object has no attribute 'lineno'
It can be fixed by catching SystemError
in lint.py for the alternative import like so:
try:
from .monkey_patching import get_code_complexity
except (ValueError, SystemError):
from monkey_patching import get_code_complexity
A way to configure the maximum line length for pep8
Hey there Vladimir, love your ST plugin! ๐
When setting popup to false in the plugin settings, is there any way to display it using a keyboard shortcut? Similarly, even when popup is set to true and you hide the popup, is there a way to get it back?
Forgive me if this is a silly question, but I can't seem to figure it out ๐
Cheers
Fotis
For me, with Sublime Text 3 on Mac, when Flake8Lint is run on save, the highlights don't show, gutter marks don't show and selecting an error or warning in the pop-up doesn't move the cursor to that line. Using the keyboard short-cut works as expected.
Installed on ST3 using package installer, getting "Python Flake8 Lint error:
sorry, can't find correct plugin path" on save.
Why I can't ignore "imported but unused" warnings anymore? The code doesn't show in the message (used to be W402, iirc), and putting it on the ignore list doesnt't work either. It might be a nice thing to do, removing unused imports, but it's a big inconvenient when the code is under heavy development (for me, at least).
Flake8 is calling this invalid syntax:
def imgMV(*args, img_dir=False):
In Python 3 this is key-word only parameter syntax. Is there a way to address this?
I tried specifying "python3.exe" (Yes, I'm on Windows unfortunately) as the interpreter instead of "auto", but that didn't work for obvious reasons.
It is not possible to override the default pep8 ignores of "E123", "E226" and "E24".
With the default config of "ignore": []
or even with "select": ["E123", "E226", "E24"]
in order to run all checks, they are still ignored.
This is using ST2 on OS X with Python 3.3.2 and Flake8Lint at commit 2c402c1.
Could you add a feature to go to the next detected error with a keystroke? Then I could happily bounce through a file without relying so much on the popup menu.
PS: I'm coming from SublimeLinter and couldn't be more thrilled to find Flake8Lint. It's very close to my ideal of what a checker should be like. Thank you!
Hello again,
Have you considered the possibility of running flake8 each time code is changed in real-time? If this was run in a separate thread and was made optional, it would be great to have so that errors would be instantly visible without having to save or run flake8 with a keyboard shortcut.
Cheers
Fotis
Hello guys,
I've installed this plugin in my sublime text 3 and every time I save the file, the Flake8Lint runs over all my project's files.
I wan't to run it only in the same file I am saving, is that possible?
Cheers,
Maybe I am missing something, but seems like it just doesn't work with this particular warning.
I installed the package and when I try to open the default preferences this file gets opened:
Packages/Flake8Lint/Flake8Lint.sublime-settings
but this file/folder doesn't exist. Package Control installs the package under:
Packages/Python Flake8 Lint/Flake8Lint.sublime-settings
I am looking for a kot key / keyboard shortcut. Something like "start Flake8lint" and "jump to next/first lint error"
I think it would be nice to provide better complexity check explanation. At least, a link to this would be nice so one immediately knows what is the meaning of complexity
number and what values are recommended.
Not sure if this is an issue or just me not understanding how to configure the plugin, but for those of us who do i18n and l10n it would be good if the plugin would not complain for each time the _
function is called, when the latter has been installed globally via gettext.install()
It seems some support has been added for this in Flake8 itself.
Cheers! :)
It would be awesome if I could do something like this:
from flask import Flask
app = Flask(__name__)
import views.py # ignore W402
Sometimes I want to break rules and there are good reasons to do so, but I don't want the warning to pop up every time I work with file where I did such thing - it's very annoying. Also, I do not want to ignore those errors and warnings globally, because at other places it would be a mistake indeed and I want to be warned about it.
Ad hoc ingoring would solve this and it would be also a message to code readers that such "mistake" was done intentionally, that author knows about it.
... due to an import error:
Writing file โฆโฆโฆ with encoding UTF-8 (atomic)
Flake8Lint ERROR: Traceback (most recent call last):
Flake8Lint ERROR: File "/Users/georg/Library/Application Support/Sublime Text 3/Packages/Python Flake8 Lint/lint.py", line 209, in
Flake8Lint ERROR: import argparse
Flake8Lint ERROR: ImportError: No module named argparse
How can i fix that?
After the changes of October 7 and 8, having anything other than an empty list for the ignore
key of my user settings causes Flake8Lint to sometimes not report any output at all.
Here's my ignore key:
"ignore": [
"E501", // 80 column lines
"E261", // at least two spaces before an inline comment
"W293", // blank line contains whitespace
"E303", // too many blank lines
"W291", // trailing whitespace
"W391", // more whitespace annoyances
"E702", // multiple statements on one line -- semicolons!
"E302" // annoying multiple whitespace issues?
]
With the latest commit (120b1d115
), important PEP8 errors that I do want to catch, like E251: no spaces around keyword / parameter equals
are no longer flagged. On the other hand, if I use an empty list:
"ignore": []
Then Flake8Lint will report all errors (including E251
) as expected.
For the time being, I've reverted back to the initial commit, 685f1236
. This is working fine.
This package cannot be installed using package control in ST3.
From https://github.com/wbond/package_control_channel/blob/master/repository/p.json it looks like the package is listed as only ST2 compatible.
{
"name": "Python Flake8 Lint",
"details": "https://github.com/dreadatour/Flake8Lint",
"labels": ["linting"],
"releases": [
{
"sublime_text": "<3000",
"details": "https://github.com/dreadatour/Flake8Lint/tree/master"
}
]
}
Example error position: 0aec077#commitcomment-4879467
You must use {0} instead of {} in Python <2.7. Sublime Text 2 uses 2.6.6 (under Ubuntu at least).
See http://stackoverflow.com/a/8498327/135079 for details.
Traceback:
Traceback (most recent call last):
File "./sublime_plugin.py", line 362, in run_
File "./Flake8Lint.py", line 205, in run
ValueError: zero length field name in format
ConnectionError exceptions and other built-in exceptions give an undefined name error when linting.
A list of built-in exceptions can be found here.
Traceback (most recent call last):
File "C:\Program Files\Sublime Text 3 Portable Beta\sublime_plugin.py", line 549, in run_
return self.run(edit)
File "C:\Program Files\Sublime Text 3 Portable Beta\Data\Packages\Python Flake8 Lint\Flake8Lint.py", line 167, in run
if skip_file(filename):
File "C:\Program Files\Sublime Text 3 Portable Beta\Data\Packages\Python Flake8 Lint\lint.py", line 52, in skip_file
return _flake8_noqa(''.join(readlines(path))) is not None
File "C:\Program Files\Sublime Text 3 Portable Beta\Data\Packages\Python Flake8 Lint\contrib\pep8.py", line 1030, in readlines
f = open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Program Files\\Sublime Text 3 Portable Beta\\Data\\Packages\\Plugin Debugger\\debug_example.py'
error: Unable to save C:\Program Files\Sublime Text 3 Portable Beta\Data\Packages\Plugin Debugger\debug_example.py
Error: Das System kann den angegebenen Pfad nicht finden.
Windowsx64, ST 3056
Install instructions say I can install it via Package Control but it does not come up in the list of packages
New install of Sublime Text 2
Hello!
Thank you for good plugin!
But as I see - this is no way to set which files to ignore. Plugin linted my *.mako files and doing it wrong. How I can disable it for mako files?
No changes that I make to the Flake8Lint.sublime-settings file seem to affect the function of Flake8Lint.
I took a stab at debugging this issue, it seems to be stemming from this: http://www.sublimetext.com/forum/viewtopic.php?f=6&t=12054
I've been getting a syntax error for "yield from", which is understandable, seeing how my default python interpreter is 2.7. To get rid of the error, I changed "python_interpreter" in Flake8Lint settings, from "auto" to "/usr/bin/python3.4".
Now most error are simply ignored. One of the few that still showup is "unexpected indent" error. But for the most part, I can write horrible code with incorrect syntax, and it won't even show me a warning.
If I change "python_interpreter" to "/usr/bin/python" instead, everything works fine as expected.
Hi,
I got used to this plugin on ST2 and recently switched to ST3, but it doesn't work there.
I corrected print statements and relative imports, so that there were no exceptions in ST Python console, but that doesn't seem enough.
Are there any plans for ST3 support, or any advice how to get there w/o learning through code?
TIA
Dict comprehensions generate syntax errors:
{i: 1 for i in range(5)}
for example, would generate invalid syntax
. The original flake8
installed from pip
does not exhibit this behaviour.
Is there a way to set the highlight color inside the plugin? If not, could be a good feature!
I'm having trouble actually using the plugin. I'm on ST2 and flake8 won't fire with both ctrl+alt+8 and on save.
Nothing happens, I have an undefined variable that I'm manipulating in the file and nothing is prompting me over anything.
Every time Lint calls the subprocess a Command Prompt window is created and then soon destroyed when the subprocess exits.
The Packages directory default is "Flake8Lint" but the path hardcoded in the last commit is "Python Flake8 Lint". This prevented the plugin from working on my system.
This dictionary comprehension is raising a linting error for "undefined name loc_list" despite the fact that I declare it in the previous line. The code runs fine.
loc_list = ['city', 'region_name', 'country_name']
self.location = {key: in_location[key] for key in loc_list
if key in in_location and in_location[key]}
At the project level, a tox.ini file or a setup.cfg file is read if present. Only the first file is considered. If this file does not have a [flake8] section, no project specific configuration is loaded.
http://flake8.readthedocs.org/en/latest/config.html#per-project
However, I have a project which using a tox.ini
file which does not specify any pep8 settings at all, and certainly does not have a [flake8] section, and it is still picked up by Flake8Lint. Since the settings is loaded from the tox.ini
file although there is no PEP8settings specified in it, the result is that my PEP8 settings specified in my Sublime config is overridden by the defaults.
Following the recommendations from here I tried to configure a project with a .pep8
file. The content of the file is this:
[flake8]
ignore = W191
max-line-length = 120
The file is located in the root of my project folder (i.e.: in the directory assigned to path
under folders
when I edit my project in ST.
I made various other attempts including:
setup.cfg
[pep8]
"use_project_config": true
in my Flake8 settings (despite this being the default)However, no matter what, ST3 does seem to ignore my project settings...
Thank you in advance for your help! :)
hi, "ctrl+alt+8" shortcut clash with "[" key on non US/GB keyboards ... very annoying
Writing file /Users/dchaplinsky/Projects/requests-mock/r-mock.py with encoding UTF-8
Flake8Lint ERROR: usage: lint.py [-h] [--pyflakes] [--builtins BUILTINS] [--pep8]
Flake8Lint ERROR: [--complexity COMPLEXITY]
Flake8Lint ERROR: [--pep8-max-line-length PEP8_MAX_LINE_LENGTH]
Flake8Lint ERROR: filename
Flake8Lint ERROR: lint.py: error: argument --pep8-max-line-length: invalid int value: 'None'
Simply installed it via package control and boom. It doesn't work. I didn't alter the settings.
When I try to run Flake8Lint in a file in which some commented words contain accents (as, for instance, my name), I get the following error
Traceback (most recent call last):
File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 549, in run_
return self.run(edit)
File "/Users/albireo/Library/Application Support/Sublime Text 3/Packages/Python Flake8 Lint/Flake8Lint.py", line 94, in run
if skip_file(filename):
File "/Users/albireo/Library/Application Support/Sublime Text 3/Packages/Python Flake8 Lint/lint.py", line 37, in skip_file
content = f.read()
File "X/encodings/ascii.py", line 26, in decode
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 481: ordinal not in range(128)
and not linting is done. If I remove the accent everything works again. I'm in ST3. In ST2 everything works ok.
Currently I have a project with exclude= in the setup.cfg but these line getting ignored even turning on the settings for the setup.cfg.
Given this seems to store config in its own config file and then pass it to flake8 (otherwise how else can we reconfigure it in the sublime plugin config and have flake8 respect it) .. can we get some kind of per file ignore options.
Id love to be able to add something like "# {flake8 : {ignore: [E1, E2, etc]}}" at the top of certain files to only ignore them rather than having to do the project wide settings or keep reconfiguring , or keep ignoring warnings since I dont want to put # noqa on the line which stops all error checking dead, which is sometimes undesirable when you only want to ignore 1 long line by a few chars in an entire file for readability purposes but otherwise stick exactly to the pep8 line lengths.
Hello,
Flake8Lint stopped working for me suddenly. I am using Sublime Text 3 build 3065 on Windows and version 1.2.0 of Flake8Lint.
Got a traceback from the ST console with the following when saving a file:
Flake8Lint ERROR: Traceback (most recent call last):
Flake8Lint ERROR: File "C:\Users\bastula\AppData\Roaming\Sublime Text 3\Packages\Python Flake8 Lint\lint.py", line 292, in <module>
Flake8Lint ERROR: for warning in lint(filename, settings):
Flake8Lint ERROR: File "C:\Users\bastula\AppData\Roaming\Sublime Text 3\Packages\Python Flake8 Lint\lint.py", line 181, in lint
Flake8Lint ERROR: pyflakes.api.checkPath(filename, flakes_reporter)
Flake8Lint ERROR: File "C:\Users\bastula\AppData\Roaming\Sublime Text 3\Packages\Python Flake8 Lint\contrib\pyflakes\api.py", line 86, in checkPath
Flake8Lint ERROR: return check(codestr, filename, reporter)
Flake8Lint ERROR: File "C:\Users\bastula\AppData\Roaming\Sublime Text 3\Packages\Python Flake8 Lint\contrib\pyflakes\api.py", line 58, in check
Flake8Lint ERROR: w = checker.Checker(tree, filename)
Flake8Lint ERROR: File "C:\Users\bastula\AppData\Roaming\Sublime Text 3\Packages\Python Flake8 Lint\contrib\pyflakes\checker.py", line 253, in __init__
Flake8Lint ERROR: self.handleChildren(tree)
Flake8Lint ERROR: File "C:\Users\bastula\AppData\Roaming\Sublime Text 3\Packages\Python Flake8 Lint\contrib\pyflakes\checker.py", line 520, in handleChildren
Flake8Lint ERROR: self.handleNode(node, tree)
Flake8Lint ERROR: File "C:\Users\bastula\AppData\Roaming\Sublime Text 3\Packages\Python Flake8 Lint\contrib\pyflakes\checker.py", line 555, in handleNode
Flake8Lint ERROR: handler(node)
Flake8Lint ERROR: File "C:\Users\bastula\AppData\Roaming\Sublime Text 3\Packages\Python Flake8 Lint\contrib\pyflakes\checker.py", line 779, in CLASSDEF
Flake8Lint ERROR: for keywordNode in node.keywords:
Flake8Lint ERROR: AttributeError: 'ClassDef' object has no attribute 'keywords'
The package was working previously and stopped working without any indication.
I use mechanize
library for a small python project.
Why does Sublime Text 2 (with Flake8Lint) shows me that there is no such member select_form()
in browser.
I have checked _mechanize.py and there it is.
Also why it can find open()
member?
I import mechanize with simple:
import mechanize
Here is what I get:
After saving a file, the error list shows but selecting an entry does not initiate a jump to the corresponding line whereas everything works fine when running the linter with CTRL-ALT-8
. According to metadata.json I'm running 1.0.4.
The console displays the following:
Writing file [full path omitted]/tests.py with encoding UTF-8 (atomic)
Quick panel unavailable
My settings are as follows:
{
"ignore": ["E124", "E128", "F403" ]
}
It would be nice if we could override the User settings with project-specific configuration. Something like biermeester/Pylinter@bfb30ba has.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.