gitlab-org--gitlab-foss/lib/gitlab/string_regex_marker.rb
Yorick Peterse 2039c8280d
Disable existing offenses for the CodeReuse cops
This whitelists all existing offenses for the various CodeReuse cops, of
which most are triggered by the CodeReuse/ActiveRecord cop.
2018-09-11 17:32:00 +02:00

17 lines
410 B
Ruby

module Gitlab
class StringRegexMarker < StringRangeMarker
# rubocop: disable CodeReuse/ActiveRecord
def mark(regex, group: 0, &block)
ranges = []
raw_line.scan(regex) do
begin_index, end_index = Regexp.last_match.offset(group)
ranges << (begin_index..(end_index - 1))
end
super(ranges, &block)
end
# rubocop: enable CodeReuse/ActiveRecord
end
end