How to configure VIM ALE to use cookstyle linter

Viewed 141
1 Answers

There are ale_linters for Chef distributed with ALE, so it would be a matter of setting your filetype=chef for these Ruby files matching a certain directory path. This can be done with something like (of course, adjust accordingly to your local directory structure):

autocmd BufNewFile,BufRead */recipes/*.rb set ft=chef syntax=ruby

Then when running :ALEInfo you will see output like:

 Current Filetype: chef                                                                                                                
Available Linters: ['cookstyle', 'foodcritic']
  Enabled Linters: ['cookstyle', 'foodcritic']
  Ignored Linters: []
 Suggested Fixers:
  'remove_trailing_lines' - Remove all blank lines at the end of a file.
  'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
 Linter Variables:
let g:ale_chef_cookstyle_executable = 'cookstyle'
let g:ale_chef_cookstyle_options = ''
let g:ale_chef_foodcritic_executable = 'foodcritic'
let g:ale_chef_foodcritic_options = ''
 Global Variables:
...
Related