diff --git a/lib/haml_lint/linter.rb b/lib/haml_lint/linter.rb index 473f459..58a07c2 100644 --- a/lib/haml_lint/linter.rb +++ b/lib/haml_lint/linter.rb @@ -37,7 +37,7 @@ def run(document, autocorrect: nil) # rubocop:disable Metrics :error ) rescue StandardError => e - msg = "Couldn't process the file".dup + msg = +"Couldn't process the file" if @autocorrect # Those lints related to auto-correction were not saved, so don't display them @lints = [] @@ -231,7 +231,7 @@ def tag_with_inline_text(tag_node) # excess whitespace @document.source_lines[(tag_node.line - 1)...(following_node_line(tag_node) - 1)] .map do |line| - line.strip.gsub(/\|\z/, '').rstrip + line.strip.delete_suffix('|').rstrip end.join(' ') end end diff --git a/lib/haml_lint/ruby_extraction/chunk_extractor.rb b/lib/haml_lint/ruby_extraction/chunk_extractor.rb index 8b86b4c..a565cc0 100644 --- a/lib/haml_lint/ruby_extraction/chunk_extractor.rb +++ b/lib/haml_lint/ruby_extraction/chunk_extractor.rb @@ -546,7 +546,7 @@ def extract_raw_ruby_lines(haml_processed_ruby_code, first_line_index) joined_lines = lines.join("\n") if haml_processed_ruby_code.include?("\n") - haml_processed_ruby_code = haml_processed_ruby_code.gsub("\n", ' ') + haml_processed_ruby_code = haml_processed_ruby_code.tr("\n", ' ') end haml_processed_ruby_code.split(/[, ]/)