2

On a .python file, I see the following for :ALEInfo

:ALEInfo
 Current Filetype: python
Available Linters: ['flake8', 'mypy', 'prospector', 'pycodestyle', 'pydocstyle', 'pyflakes', 'pylint', 'pyls', 'pyre', 'vulture']
  Enabled Linters: ['flake8', 'mypy', 'pylint']

Why is pycodestyle not enabled? Is there a way I can automatically enable it for all python files? I have pycodestyle already installed with pip, from the command line I can do pycodestyle . and it works.

Tri Nguyen
  • 233
  • 2
  • 11

2 Answers2

5

I just found out that only flake8, mypy and pylint are enabled by default. I was trying to find out before but couldn't until someone pointed to

https://github.com/w0rp/ale/blob/master/doc/ale.txt#L1438

or :help ale_linters

In order to enable new linters, I need to set:

let g:ale_linters = {'python': ['pycodestyle']}

The doc above has this part:

  The |g:ale_linters| option sets a |Dictionary| mapping a filetype to a
  |List| of linter programs to be run when checking particular filetypes.

  This |Dictionary| will be merged with a default dictionary containing the
  following values: >

  {
  \   'csh': ['shell'],
  \   'elixir': ['credo', 'dialyxir', 'dogma', 'elixir-ls'],
  \   'go': ['gofmt', 'golint', 'go vet'],
  \   'hack': ['hack'],
  \   'help': [],
  \   'perl': ['perlcritic'],
  \   'perl6': [],
  \   'python': ['flake8', 'mypy', 'pylint'],
  \   'rust': ['cargo'],
  \   'spec': [],
  \   'text': [],
  \   'vue': ['eslint', 'vls'],
  \   'zsh': ['shell'],
  \}
Tri Nguyen
  • 233
  • 2
  • 11
3

One thing you should be aware of: flake8 invokes pycodestyle and pyflakes. So configuring ale to run flake8 and either of those two will lead to duplicate warnings:

https://github.com/dense-analysis/ale/issues/888