Code Monkey home page Code Monkey logo

flake8lint's People

Contributors

bandoche avatar bystroushaak avatar deni64k avatar dreadatour avatar entropiae avatar fgmacedo avatar hashier avatar jcugat avatar ludwiktrammer avatar meloncholy avatar pzinovkin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flake8lint's Issues

pep8 import unused error

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'

FLAKE8Lint does not work for me in ST3...

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!

ValueError: invalid literal for int() with base 10: 'lint.py'

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.

Problem decoding source

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.

lint_on_load needs a time delay

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?)

ST3: Parent module '' not loaded

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

Is it possible to show the popup using a keyboard shortcut?

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

On save does not highlight, popup problems

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.

Import Unused

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).

Does not handle Python 3 Syntax.

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.

ignore and select settings not overriding pep8 defaults ignores

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.

"Next error" keyboard shortcut

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!

FR: Optional real-time operation (In a separate thread)

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

Search only in the current file

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,

Wrong folder name if installed via Package Control

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

Complexity check explanation

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.

gettext.install() and other globals

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! :)

Syntax for ad hoc ignoring

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.

FLAKE8Lint does not work for me in ST3...

... 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?

Flake8Lint no longer consistently handles `ignore` settings.

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.

Missing built-in exceptions

ConnectionError exceptions and other built-in exceptions give an undefined name error when linting.
A list of built-in exceptions can be found here.

Uncaught exception when saving in ST fails (e.g. when the path does not exist anymore)

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

Not found in package control

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

Problem with *.mako files

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 errors after changing python_interpreter

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.

ST3 support?

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 comprehesions do not work

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.

Not linting?

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.

Getting a linting error where I shouldn't be

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]}

Project-level files without [flake8] section does not seem to be ignored

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.

Per-project settings are not loaded by ST3

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:

  • Renaming the file it to setup.cfg
  • Renaming the file section to [pep8]
  • Moving the file in the same directory of my sublime project file (one level up compared to what I explained above)
  • Restarting ST altogether
  • Explicitly set "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! :)

Problem with PEP8_MAX_LINE_LENGTH setting

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.

Problem in files with accents

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.

Finer Grained settings support

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.

Flake8Lint stopped working randomly

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.

E1101 Error without any reason

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:

enter image description here

No move to error line/char on select

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" ]
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.