Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for # noqa #281

Open
maxnordlund opened this issue Mar 1, 2018 · 12 comments
Open

Add support for # noqa #281

maxnordlund opened this issue Mar 1, 2018 · 12 comments

Comments

@maxnordlund
Copy link

This is used at least by pycodestyle and flake8 to ignore a certain line from all linting. I personally use it when from .conftest import * # noqa in pytest.

PyCQA/pycodestyle#476

@gatesn
Copy link
Contributor

gatesn commented Mar 25, 2018

I also see that noqa is not respected, though I can't see any reason why it wouldn't be! Will need to dig in a bit more.

@randy3k
Copy link
Contributor

randy3k commented May 7, 2018

I believe that it is because pyflakes doesn't support # noqa. Do we have the option to use flake8 instead?

@languitar
Copy link
Contributor

I am not sure what raises the "imported but unused" warnings, but that also doesn't seem to respect this comment.

@joaqo
Copy link

joaqo commented Jun 18, 2018

If you go about adding support for inline noqa flags, please consider also adding support for flake8: noqa at the beginning of the file to ignore warnings/errors in the whole file too! Thanks!

@emanspeaks
Copy link

I created a quick-and-dirty pyls plugin called pyls-flake8

Once you install it with pip, I set the pyls config to disable pyflakes and pycodestyle, restarted the server, and voila--I had all my familiar noqa options back.

@kierun
Copy link

kierun commented Nov 12, 2018

Same issue using the sure module which needs # noqa since you never use it as-is.

@doronbehar
Copy link

Well done @emanspeaks , you've helped me a lot! I think it'd be great if you'll create a PR for the '3rd party plugins' section in the README.

@kierun
Copy link

kierun commented Sep 26, 2019

It has been a while, so here's a screenshot:

screenshot

It is kinda annoying but is no deal breaker…

@BorgPrincess
Copy link

This would also be a nice feature to work for warnings - much nicer to "wave through" a single line than to give Carte Blanche to all deprecation warnings project wide... ;)

@kevr
Copy link

kevr commented Oct 21, 2021

I created a quick-and-dirty pyls plugin called pyls-flake8

Once you install it with pip, I set the pyls config to disable pyflakes and pycodestyle, restarted the server, and voila--I had all my familiar noqa options back.

You are a champion.

For anyone else dealing with this, my setup:

  • nvim 0.6.0-dev
  • Plugin prabirshrestha/vim-lsp
  • Plugin prabirshrestha/async.vim
  • Plugin prabirshrestha/asyncomplete.vim
  • Plugin prabirshrestha/asyncomplete-lsp.vim
  • Plugin mattn/vim-lsp-settings
    • :LspInstallServer pylsp-all
  • Plugin dense-analysis/ale
  • Plugin rhysd/vim-lsp-ale
  • Additional PyPi package: neovim
  • Additional PyPi package: pylsp
  • Additional PyPi package: pyls-flake8
# ~/.config/nvim/init.vim - vim-lsp-settings configuration
" Language Server Protocol configuration
let g:lsp_settings = {
\   'pylsp-all': {
\       'workspace_config': {
\           'pylsp': {
\               'configurationSources': ['flake8'],
\               'plugins': {
\                   'pycodestyle': { 'enabled': 0 },
\                   'pyflakes': { 'enabled': 0 },
\                   'flake8': { 'enabled': 1 },
\               }
\           }
\       }
\   },
\}

@gatesn
Copy link
Contributor

gatesn commented Oct 21, 2021

It does seem like at this point in time Flake8 has become the dominant linter. I'm not sure it was quite so convincing in the past.

But perhaps now the defaults should swap over to that? Any objections?

@joelthelion
Copy link

Is there still a plan to make flake8 the default some day?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests