diff --git a/lib/erb_lint/corrector.rb b/lib/erb_lint/corrector.rb index d24b3939..7ccecf5b 100644 --- a/lib/erb_lint/corrector.rb +++ b/lib/erb_lint/corrector.rb @@ -12,7 +12,7 @@ def initialize(processed_source, offenses) def corrections @corrections ||= @offenses.map do |offense| - offense.linter.autocorrect(@processed_source, offense) + offense.linter.autocorrect(@processed_source, offense) if offense.linter.class.support_autocorrect? end.compact end diff --git a/spec/erb_lint/cli_spec.rb b/spec/erb_lint/cli_spec.rb index 8b45ddb2..f1d30d01 100644 --- a/spec/erb_lint/cli_spec.rb +++ b/spec/erb_lint/cli_spec.rb @@ -514,9 +514,9 @@ def run(processed_source) end context "when autocorrecting an error" do - # We assume that linter_without_errors is not autocorrectable... + # We assume that linter_with_errors is not autocorrectable... let(:args) do - ["--enable-linter", "final_newline,linter_without_errors", "--stdin", linted_file, "--autocorrect"] + ["--enable-linter", "final_newline,linter_with_errors", "--stdin", linted_file, "--autocorrect"] end it "tells the user it is autocorrecting" do