Ameba::Spec::AnnotatedSource
Parsed representation of code annotated with the # ^^^ error: Message style
Constants
Constructors
NOTE: Annotations are sorted so that reconstructing the annotation
text via #to_s is deterministic.
Annotates the source code with the Ameba issues provided.
NOTE: Annotations are sorted so that reconstructing the annotation
text via #to_s is deterministic.
Class methods
Separates annotation lines from code lines. Tracks the real code line number that each annotation corresponds to.
Instance methods
Each entry is the line number, annotation prefix, and message. The prefix is empty if the annotation is at the end of a code line.
Constructs an annotated source string (like what we parse).
Reconstructs a deterministic annotated source string. This is useful for eliminating semantically irrelevant annotation ordering differences.
source1 = AnnotatedSource.parse(<<-CRYSTAL)
line1
^ Annotation 1
^^ Annotation 2
CRYSTAL
source2 = AnnotatedSource.parse(<<-CRYSTAL)
line1
^^ Annotation 2
^ Annotation 1
CRYSTAL
source1.to_s == source2.to_s # => true