GithubHelp home page GithubHelp logo

Comments (6)

aparajita avatar aparajita commented on August 20, 2024

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.

FichteFoll avatar FichteFoll commented on August 20, 2024

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.

aparajita avatar aparajita commented on August 20, 2024

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.

FichteFoll avatar FichteFoll commented on August 20, 2024

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.

aparajita avatar aparajita commented on August 20, 2024

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.

FichteFoll avatar FichteFoll commented on August 20, 2024

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)

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.