Comments (6)
I do not think this message is useful because linting does not work even though I don't get an error
Because you can override python versions dynamically, I really can’t flag it as an error at startup. What I can do is print linter errors to the console when you try to lint, that is on my todo list.
To specify a specific version of python, use the setting "@python": 2.7
or whatever.
Is it possible to flag a single file as being Python2
Please read this entire page. Sorry to say but SublimeLinter 3 is sufficiently feature-rich that one must read the docs to fully understand everything. I'm working on searchable docs.
from sublimelinter-flake8.
Because you can override python versions dynamically, I really can’t flag it as an error at startup.
The message shows when I open/load a Python file only, in which case the python version should be clear I guess.
To specify a specific version of python, use the setting
"@python": 2.7
or whatever.
I can't test it right now, but iirc I also tried that and it didn't work.
Please read this entire page.
I'm sorry, too, but I read the entire page twice and still don't know how to do it, or if it's possible.
What I understand is that there is a few places where settings are read from:
Inline overrides
Inline settings
.sublimelinterrc settings
Project settings
User settings
Default settings
Default and User settings apply to all files, Project settings to the project obv and .sublimelinterrc files apply to a directory. So there is only Inline settings and overrides, which are said to be specified by the respective linter. However, in https://github.com/SublimeLinter/SublimeLinter-flake8 there is no specification of @python
or that it is possible to set meta-settings there at all (which doesn't sound reasonable for inline stuff imo).
from sublimelinter-flake8.
The message shows when I open/load a Python file only, in which case the python version should be clear I guess
The python version isn’t clear just by opening a file. I have no way of heuristically knowing with 100% accuracy the python version a file is written in. That’s why you have to tell SublimeLinter with the @python setting.
I can't test it right now, but iirc I also tried that and it didn't work.
It will always work. But some linters (like pep8 and pep257) don’t care about the python version and thus will ignore @python if a python 3 module for that linter is available.
@python can be used inline. It only applies to that file in that case. I’ll make sure to document that python-based linters can use @python.
from sublimelinter-flake8.
Okay, by enabling debug mode I found out that it didn't work because of my #!/usr/bin/env python3
line.
SublimeLinter: cannot locate 'flake8@python3'
Reason is that this line is interpreted by py.exe
on Windows and it would then launch the corresponding Python version, since 3.2 I think. However, the linter tried to search for an executable named python3
and that didn't exist. Setting it to #!/usr/bin/env python3.3
solved it. Since I couldn't find it in the docs you might want to add that it uses this information for searching for the corresponding binary, which is awesome btw (and maybe a special phrase for Windows).
Quick edit: SublimeLinter used to display the error type of an error in the statusbar (and also in the popup) which made it really easy to find the error type that you want to ignore. It doesn't do that now. Would it be possible to add that again?
from sublimelinter-flake8.
https://github.com/SublimeLinter/SublimeLinter.github.io/wiki/Writing-Linters#shebang_match
I’m working on searchable docs, and the shebang matching should be mentioned in the @python section.
Actually, I’m surprised it didn’t find python 3, the matching algorithm should have matched python 3.3. What’s the path of your python 3.3?
from sublimelinter-flake8.
c:\Python33\python.exe
, the standard path. Same for 3.2 and 2.7. Thinking about it again, there is also no python3.3
executable on my PATH, so it's kinda odd.
And yeah, I didn't consider searching in the Writing Linters docs for these kind of things. I also found the @python
meta setting being available inline just below.
Edit: And to make it even more funny, setting it to #!/usr/bin/env python2
or setting @python
to 2 in the settings works.
Edit2: Mistery solved, it was automatically using my 3.2 distribution where I did not install flake8. See also SublimeLinter/SublimeLinter#41.
from sublimelinter-flake8.
Related Issues (20)
- recent update triggers ImportError of configparser module HOT 4
- Does not work at all in Sublime 3.1.1 HOT 3
- F401 handling trips on star imports HOT 3
- No linting errors reported but there should be
- Can't find this package in Package control HOT 3
- .flake8 in a subdirectory HOT 4
- can get E,W type errors, but no F type errors HOT 7
- Error: 'selector' is mandatory in 'cls.defaults' HOT 3
- Is --per-file-ignores supported for flake8 >= 3.7.0? HOT 11
- Package not showing in packaging control anymore HOT 1
- Shows E251 for function definitions having type annotations HOT 2
- Args seem to be getting ignored HOT 1
- Extend "E501 line too long" match till end of line HOT 1
- AttributeError: 'int' object has no attribute 'rstrip' HOT 3
- W type errors not showing HOT 1
- SublimeText 4 Support HOT 2
- Using per-file-ignores argument in settings causes an error HOT 4
- TypeError: expected str, bytes or os.PathLike object, not TextIOWrapper. Why extra " -" is being added after `flake8 --format default`? HOT 6
- plugin_host-3.3 has exited unexpectedly HOT 6
- List unpack operator in assignment triggers false positive HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sublimelinter-flake8.