python-language-server
python-language-server copied to clipboard
Add support for # noqa
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.
https://github.com/PyCQA/pycodestyle/issues/476
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.
I believe that it is because pyflakes doesn't support # noqa. Do we have the option to use flake8 instead?
I am not sure what raises the "imported but unused" warnings, but that also doesn't seem to respect this comment.
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!
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.
Same issue using the sure module which needs # noqa since you never use it as-is.
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.
It has been a while, so here's a screenshot:

It is kinda annoying but is no deal breaker…
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... ;)
I created a quick-and-dirty pyls plugin called pyls-flake8
Once you install it with
pip, I set the pyls config to disablepyflakesandpycodestyle, restarted the server, and voila--I had all my familiarnoqaoptions 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 },
\ }
\ }
\ }
\ },
\}
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?
Is there still a plan to make flake8 the default some day?