awslabs/duvet

Annotation placed at the end of a source file is ignored

Closed this issue · 3 comments

eagr commented

regardless of annotation type

Can you give a specific example of what's happening? I just want to make sure it's clear what exactly is happening.

eagr commented

I changed the title to better state the problem.

This may help reproduce the problem:

  • copy a requirement from the report that hasn't been annotated
  • paste it to the end of any source file that is to be scanned
  • run duvet report and check the report

The annotation seems to be ignored, as if it weren't in the source code, regardless of annotation type.

Then try putting something after that annotation, say a dummy comment, and run duvet report again. It becomes effective and is reflected in the report.

The bug here is we don't finalize the state machine after completing the last line.

duvet/src/pattern.rs

Lines 90 to 99 in 02c9245

capture.push_content(content);
state = ParserState::CapturingContent(capture);
} else {
annotations.insert(capture.done(line_no, path)?);
}
}
}
}
Ok(())

I can push a fix