Skip to content

Commit

Permalink
🐛 Fix a Ruby deprecation warning in the ERB linter (#4521)
Browse files Browse the repository at this point in the history
* Fix a Ruby deprecation warning in the ERB linter

Before, the ERB linter used positional arguments. Newer versions of Ruby
have deprecated this method signature. We fixed the linter to use
keyword arguments.

* fixup! Fix a Ruby deprecation warning in the ERB linter
  • Loading branch information
purinkle authored May 26, 2023
1 parent a46121a commit 7021ed0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ale_linters/eruby/erb.vim
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function! ale_linters#eruby#erb#GetCommand(buffer) abort
" Rails-flavored eRuby does not comply with the standard as understood by
" ERB, so we'll have to do some substitution. This does not reduce the
" effectiveness of the linter—the translated code is still evaluated.
return 'ruby -r erb -e ' . ale#Escape('puts ERB.new($stdin.read.gsub(%{<%=},%{<%}), nil, %{-}).src') . '< %t | ruby -c'
return 'ruby -r erb -e ' . ale#Escape('puts ERB.new($stdin.read.gsub(%{<%=},%{<%}), trim_mode: %{-}).src') . '< %t | ruby -c'
endfunction

call ale#linter#Define('eruby', {
Expand Down
2 changes: 1 addition & 1 deletion test/linter/test_erb.vader
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ Execute(Executable should filter invalid eRuby when inside a Rails project):
call ale#test#SetFilename('../test-files/ruby/valid_rails_app/app/views/my_great_view.html.erb')

AssertLinter 'erb',
\ 'ruby -r erb -e ' . ale#Escape('puts ERB.new($stdin.read.gsub(%{<%=},%{<%}), nil, %{-}).src') . '< %t | ruby -c'
\ 'ruby -r erb -e ' . ale#Escape('puts ERB.new($stdin.read.gsub(%{<%=},%{<%}), trim_mode: %{-}).src') . '< %t | ruby -c'

0 comments on commit 7021ed0

Please sign in to comment.