如何配置 VIM ALE 以使用 cookstyle linter

How to configure VIM ALE to use cookstyle linter

我正在尝试配置 VIM 插件 ALE to use chef cookstyle linter for chef cookbooks projects. But ALE is not throwing any errors. On the documentation I found out ALE has options for chef-based cookstyle https://github.com/dense-analysis/ale/blob/master/doc/ale.txt,但它不起作用。

我在我的vimrc文件中定义了以下配置

Chef distributed with ALEale_linters,因此需要为这些 Ruby 匹配特定目录路径的文件设置 filetype=chef。这可以通过类似的方式完成(当然,根据您的本地目录结构进行相应调整):

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

然后当 运行 :ALEInfo 你会看到如下输出:

 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:
...