Skip to content

Commit

Permalink
rubocop auto correct for regex freezing
Browse files Browse the repository at this point in the history
  • Loading branch information
PragTob committed Jun 22, 2024
1 parent 31eed31 commit f32f0b5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/simplecov/lines_classifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ class LinesClassifier
RELEVANT = 0
NOT_RELEVANT = nil

WHITESPACE_LINE = /^\s*$/.freeze
COMMENT_LINE = /^\s*#/.freeze
WHITESPACE_LINE = /^\s*$/
COMMENT_LINE = /^\s*#/
WHITESPACE_OR_COMMENT_LINE = Regexp.union(WHITESPACE_LINE, COMMENT_LINE)

def self.no_cov_line
Expand Down
4 changes: 2 additions & 2 deletions lib/simplecov/source_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def load_source
end
end

SHEBANG_REGEX = /\A#!/.freeze
SHEBANG_REGEX = /\A#!/
def shebang?(line)
SHEBANG_REGEX.match?(line)
end
Expand All @@ -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/.freeze
RUBY_FILE_ENCODING_MAGIC_COMMENT_REGEX = /\A#\s*(?:-\*-)?\s*(?:en)?coding:\s*(\S+)\s*(?:-\*-)?\s*\z/
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
Expand Down
2 changes: 1 addition & 1 deletion lib/simplecov/useless_results_remover.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def self.call(coverage_result)
end

def self.root_regx
@root_regx ||= /\A#{Regexp.escape(SimpleCov.root + File::SEPARATOR)}/i.freeze
@root_regx ||= /\A#{Regexp.escape(SimpleCov.root + File::SEPARATOR)}/i
end
end
end

0 comments on commit f32f0b5

Please sign in to comment.