dense-analysis / ale

Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support
BSD 2-Clause "Simplified" License
13.55k stars 1.44k forks source link

Make reek options configurable #2034

Open kurko opened 5 years ago

kurko commented 5 years ago

We use reek -c .todo.reek. There's no way to specify that -c option with Ale. Looking at the options in https://github.com/w0rp/ale/blob/master/doc/ale-ruby.txt, it's confirmed that there's no way to do that.

The following doesn't work.

  let b:ale_linters = {
  \   'ruby': ['reek -c .todo.reek'],
  \}
kurko commented 5 years ago

I tried

if filereadable(".todo.reek")
  g:ale_ruby_reek_executable = 'reek_with_custom_todo_file'
endif

Got this:

Pattern not found: ale_ruby_reek_executable = 'reek_with_custom_todo_file'

Weird, given g:ale_ruby_reek_executable is described in the docs...

w0rp commented 5 years ago

g:ale_ruby_reek_executable = 'reek_with_custom_todo_file' needs to be let g:ale_ruby_reek_executable = 'reek_with_custom_todo_file'. Every line of Vim script needs to be a command.

kurko commented 5 years ago

@w0rp while we're at it... do you think it's productive/scalable to have custom variables for each and every linter/fixer in the universe? Any reason not to have an open string which people can populate with whatever?

Example: g:ale_ruby_reek_executable = 'reek $* -C .todo.reek', then replace $* with whatever arguments are passed in (e.g files). I bet the code is doing some magic and can't support that?

That'd make the plugin automatically configurable and you wouldn't have to spend so much time maintaining it.

w0rp commented 5 years ago

Not every linter should be configurable with options. Some require very specific arguments, or no arguments to work. The options have to be set in different places for different commands. The executable path could contain spaces. I have thought about all of this longer than you have.

w0rp commented 5 years ago

I'll reopen this. Someone should add an _options variable for this.