add: support for rubyfmt as ruby fixer (#4678)

[rubyfmt](https://github.com/fables-tales/rubyfmt) is a formatter for
 `ruby` code.

This commit adds support for `rubyfmt` as a `ruby` fixer (#2991),
together with some tests and documentation.
This commit is contained in:
Yining
2024-01-14 22:59:20 +11:00
committed by GitHub
parent 17cca243e3
commit 3dbf0b2202
7 changed files with 68 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
Before:
Save g:ale_ruby_rubyfmt_executable
Save g:ale_ruby_rubyfmt_options
Save &l:expandtab
Save &l:shiftwidth
Save &l:tabstop
After:
Restore
Execute(The rubyfmt callback should return 'rubyfmt' as default command):
setlocal noexpandtab
Assert
\ ale#fixers#rubyfmt#Fix(bufnr('')).command =~# '^' . ale#Escape('rubyfmt'),
\ "Default command name is expected to be 'rubyfmt'"
Execute(The ruby executable and options should be configurable):
let g:ale_ruby_rubyfmt_executable = 'foobar'
let g:ale_ruby_rubyfmt_options = '--some-option'
AssertEqual
\ {
\ 'command': ale#Escape('foobar')
\ . ' --some-option',
\ },
\ ale#fixers#rubyfmt#Fix(bufnr(''))