17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/rubocop/cop/style/comment_annotation.rb', line 17
def investigate(processed_source)
processed_source..each do ||
margin, first_word, colon, space, note = ()
next unless annotation?() &&
!correct_annotation?(first_word, colon, space, note)
start = .loc.expression.begin_pos + margin.length
length = first_word.length + colon.to_s.length + space.to_s.length
source_buffer = .loc.expression.source_buffer
range = Parser::Source::Range.new(source_buffer,
start,
start + length)
if note
add_offense(, range, format(MSG, first_word))
else
add_offense(, range, format(MISSING_NOTE, first_word))
end
end
end
|