From 3661e67614facd888b836393ba31622d8f7b8ad0 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Tue, 27 Aug 2024 10:39:08 +0900 Subject: [PATCH] rubocop -A --only Style/MutableConstant --- lib/simplecov/lines_classifier.rb | 4 ++-- lib/simplecov/source_file.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/simplecov/lines_classifier.rb b/lib/simplecov/lines_classifier.rb index c86311c3..41026840 100644 --- a/lib/simplecov/lines_classifier.rb +++ b/lib/simplecov/lines_classifier.rb @@ -8,8 +8,8 @@ class LinesClassifier RELEVANT = 0 NOT_RELEVANT = nil - WHITESPACE_LINE = /^\s*$/ - COMMENT_LINE = /^\s*#/ + WHITESPACE_LINE = /^\s*$/.freeze + COMMENT_LINE = /^\s*#/.freeze WHITESPACE_OR_COMMENT_LINE = Regexp.union(WHITESPACE_LINE, COMMENT_LINE) def self.no_cov_line diff --git a/lib/simplecov/source_file.rb b/lib/simplecov/source_file.rb index 43fbfba6..3d9efcd6 100644 --- a/lib/simplecov/source_file.rb +++ b/lib/simplecov/source_file.rb @@ -190,7 +190,7 @@ def load_source end end - SHEBANG_REGEX = /\A#!/ + SHEBANG_REGEX = /\A#!/.freeze def shebang?(line) SHEBANG_REGEX.match?(line) end @@ -202,7 +202,7 @@ def read_lines(file, lines, current_line) lines.concat([current_line], ensure_remove_undefs(file.readlines)) end - RUBY_FILE_ENCODING_MAGIC_COMMENT_REGEX = /\A#\s*(?:-\*-)?\s*(?:en)?coding:\s*(\S+)\s*(?:-\*-)?\s*\z/ + RUBY_FILE_ENCODING_MAGIC_COMMENT_REGEX = /\A#\s*(?:-\*-)?\s*(?:en)?coding:\s*(\S+)\s*(?:-\*-)?\s*\z/.freeze def set_encoding_based_on_magic_comment(file, line) # Check for encoding magic comment # Encoding magic comment must be placed at first line except for shebang