neoclide / coc-python

Python extension for coc.nvim, fork of vscode-python
574 stars 51 forks source link

Can't disable pylint - understanding linter configuration #64

Closed deto closed 5 years ago

deto commented 5 years ago

I'm trying to disable pyLint and only have flake8. I've tried these things:

  1. ran python.setLinter and set flake8
  2. have "python.linting.pylintEnable": false in my config

However, still when I save, pylint is being run on the file. Is there a separate config for on-save linters?

It's also possible that my coc-settings.json just isn't set up correctly. Right now the file looks like this (with the languageserver settings in the outermost level and the coc-python settings outside the languageserver settings):


{
  "languageserver": {
    "python": {
      "command": "python",
      "args": [
        "-mpyls",
        "-vv",
        "--log-file",
        "/tmp/lsp_python.log"
      ],
      "trace.server": "verbose",
      "filetypes": [
        "python"
      ],
      "settings": {
        "pyls": {
          "enable": true,
          "trace": {
            "server": "verbose"
          },
          "commandPath": "",
          "configurationSources": [
            "pycodestyle"
          ],
          "plugins": {
            "jedi_completion": {
              "enabled": true
            },
            "jedi_hover": {
              "enabled": true
            },
            "jedi_references": {
              "enabled": true
            },
            "jedi_signature_help": {
              "enabled": true
            },
            "jedi_symbols": {
              "enabled": true,
              "all_scopes": true
            },
            "mccabe": {
              "enabled": true,
              "threshold": 15
            },
            "preload": {
              "enabled": true
            },
            "pycodestyle": {
              "enabled": true
            },
            "pydocstyle": {
              "enabled": false,
              "match": "(?!test_).*\\.py",
              "matchDir": "[^\\.].*"
            },
            "pyflakes": {
              "enabled": true
            },
            "rope_completion": {
              "enabled": true
            },
            "yapf": {
              "enabled": true
            }
          }
        }
      }
    }
  },

  "python.linting.enable": true,
  "python.linting.pylintEnable": false,
}
chemzqm commented 5 years ago

Checkout if there is .vim/coc-settings.json in the parent folders of your python file, or you can try if it works in different folder.

deto commented 5 years ago

There was a .vim/coc-settings.json file with this in it:

{
  "python.jediEnabled": false,
  "python.linting.flake8Enabled": true,
  "python.linting.enabled": true
}

I suppose this is how commands like python.setLinter store their settings?

However, after removing that file, I see the same behavior. I've also removed any other plugins from my init.vim just to make sure.

Is coc.nvim running linters on its own (independently of coc-python)? I don't really know the details of what is done by which (coc.nvim vs. coc-python), and I'm still digesting the configuration options.

chemzqm commented 5 years ago

Can't reproduce, maybe it comes from your other plugins, try it with minimal vimrc, or disable coc-python to see if you still have them.

chemzqm commented 5 years ago

Use python.setLinter command to get current activated linters.

deto commented 5 years ago

Thought I had fixed it, but it still persists - I realized I used 'pylintEnable' instead of 'pylintEnabled' in the configuration file.

However, after changing this, it's still happening. I'm using a fully minimal vimrc now.

If I run python.setLinter, it shows the list of available linters and at the top displays "current: none"

If I use workspace.showOutput and select languageserver.python I can confirm that it's coming from the language server.

However, disabling coc-python did not remove the linting. It appears that the python language server (I'm using the palantir one, not the MS one) will, by default, enable plugins. I was able to fix it by adding this to my coc-settings:

"languageserver.python.settings.pyls.plugins.pylint_lint.enabled": false

(Though not exactly, I'm sticking the JSON hierarchy inside the object key)

So it seems like the language server was setting linting independently of coc-python? Does coc-python manage linting separately, or is it supposed to just manage settings for the language server in a better way?

chemzqm commented 5 years ago

@deto No, checkout :CocList services, you have configured language server instead. You should remove configured server for python when using coc-pythong.

deto commented 5 years ago

Got it - the coc.nvim documentation does not make this clear and seems to imply that you need both. I'll file an issue with them to clarify. Thank you!

dyno commented 4 years ago

interestingly, i have to follow this issue https://github.com/palantir/python-language-server/issues/433 and configure setup.cfg to quiet pycodestyle warnings from language server. and there seems no configuration works to disable the linting from coc-python.

my environment is neovim/coc.nvim/coc-python