我正在尝试配置 VIM 插件 ALE使用 Chef cookstyle用于 Chef Recipe 项目的 linter。但 ALE 没有抛出任何错误。在文档中我发现ALE有基于 Chef 的 cooking 风格的选项https://github.com/dense-analysis/ale/blob/master/doc/ale.txt ,但它不起作用。
最佳答案
Chef 有 ale_linters
distributed with ALE ,因此需要为这些与特定目录路径匹配的 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:
...
关于vim - 如何配置 VIM ALE 以使用 cookstyle linter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64933458/