lib/rubocop/cop/layout/comment_indentation.rb in rbhint-0.85.1.rc1 vs lib/rubocop/cop/layout/comment_indentation.rb in rbhint-0.85.1.rc2
- old
+ new
@@ -1,11 +1,11 @@
# frozen_string_literal: true
module RuboCop
module Cop
module Layout
- # This cop checks the indentation of comments.
+ # This hint checks the indentation of comments.
#
# @example
# # bad
# # comment here
# def method_name
@@ -107,11 +107,11 @@
)
end
def own_line_comment?(comment)
own_line = processed_source.lines[comment.loc.line - 1]
- own_line =~ /\A\s*#/
+ /\A\s*#/.match?(own_line)
end
def line_after_comment(comment)
lines = processed_source.lines
lines[comment.loc.line..-1].find { |line| !line.blank? }
@@ -127,14 +127,14 @@
0
end
end
def less_indented?(line)
- line =~ /^\s*(end\b|[)}\]])/
+ /^\s*(end\b|[)}\]])/.match?(line)
end
def two_alternatives?(line)
- line =~ /^\s*(else|elsif|when|rescue|ensure)\b/
+ /^\s*(else|elsif|when|rescue|ensure)\b/.match?(line)
end
end
end
end
end