class Pronto::ClangTidy::Offence

a class that groups multiple related diagnostics together

Clang uses NOTE-level diagnostics to staple more information onto previous diagnostics. The Offence class groups a diagnostic along with all subsequent NOTE-level diagnostics into a single entity.

Attributes

main[R]
notes[R]

Private Class Methods

new(main_diagnostic) click to toggle source
# File lib/pronto/clang_tidy/offence.rb, line 12
def initialize(main_diagnostic)
  @main = main_diagnostic
  @notes = []
end

Private Instance Methods

<<(note_diagnostic) click to toggle source
# File lib/pronto/clang_tidy/offence.rb, line 17
def <<(note_diagnostic)
  @notes << note_diagnostic
end
main_message() click to toggle source

the message to be attached to the main diagnostic's line

# File lib/pronto/clang_tidy/offence.rb, line 22
def main_message
  result = "#{main.message}\n"
  notes.each do |note|
    result << note.format_diagnostic
  end
  result
end
note_message() click to toggle source

the message to be attached to any of the notes' lines

this is used only when the main diagnostic's line is not changed

# File lib/pronto/clang_tidy/offence.rb, line 33
def note_message
  result = main.format_diagnostic
  notes.each do |note|
    result << note.format_diagnostic
  end
  result
end