From 7021ed0c6859ec8b1bf5012d1276d54a786449c3 Mon Sep 17 00:00:00 2001 From: Rob Whittaker Date: Fri, 26 May 2023 06:52:51 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20a=20Ruby=20deprecation=20w?= =?UTF-8?q?arning=20in=20the=20ERB=20linter=20(#4521)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- ale_linters/eruby/erb.vim | 2 +- test/linter/test_erb.vader | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ale_linters/eruby/erb.vim b/ale_linters/eruby/erb.vim index f3438320b6..0ca157aa89 100644 --- a/ale_linters/eruby/erb.vim +++ b/ale_linters/eruby/erb.vim @@ -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', { diff --git a/test/linter/test_erb.vader b/test/linter/test_erb.vader index c64c7ba58d..4adffcba2a 100644 --- a/test/linter/test_erb.vader +++ b/test/linter/test_erb.vader @@ -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'