Commit 2edced5d authored by Ramin Halavati's avatar Ramin Halavati Committed by Commit Bot

Update traffic_annotation_auditor's safe list processing.

A minor bug in processing safe list in traffic annotation auditor is
fixed.

Bug: 690323
Change-Id: I76f6d023f88106bf69b6c5546142afb52e8e37c5
Reviewed-on: https://chromium-review.googlesource.com/1054877
Commit-Queue: Ramin Halavati <rhalavati@chromium.org>
Reviewed-by: default avatarGeorges Khalil <georgesak@chromium.org>
Cr-Commit-Position: refs/heads/master@{#558206}
parent e90e948c
...@@ -441,26 +441,23 @@ bool TrafficAnnotationAuditor::ParseClangToolRawOutput() { ...@@ -441,26 +441,23 @@ bool TrafficAnnotationAuditor::ParseClangToolRawOutput() {
if (block_type == "ANNOTATION") { if (block_type == "ANNOTATION") {
AnnotationInstance new_annotation; AnnotationInstance new_annotation;
result = new_annotation.Deserialize(lines, current, end_line); result = new_annotation.Deserialize(lines, current, end_line);
result.set_file_path( std::string file_path = result.IsOK()
MakeRelativePath(absolute_source_path_, result.file_path())); ? new_annotation.proto.source().file()
if (IsSafeListed(result.file_path(), : result.file_path();
AuditorException::ExceptionType::ALL)) { file_path = MakeRelativePath(absolute_source_path_, file_path);
if (IsSafeListed(file_path, AuditorException::ExceptionType::ALL))
result = AuditorResult(AuditorResult::Type::RESULT_IGNORE); result = AuditorResult(AuditorResult::Type::RESULT_IGNORE);
}
switch (result.type()) { switch (result.type()) {
case AuditorResult::Type::RESULT_OK: case AuditorResult::Type::RESULT_OK:
new_annotation.proto.mutable_source()->set_file(MakeRelativePath( new_annotation.proto.mutable_source()->set_file(file_path);
absolute_source_path_, new_annotation.proto.source().file()));
extracted_annotations_.push_back(new_annotation); extracted_annotations_.push_back(new_annotation);
break; break;
case AuditorResult::Type::ERROR_MISSING_TAG_USED: case AuditorResult::Type::ERROR_MISSING_TAG_USED:
if (IsSafeListed(result.file_path(), if (IsSafeListed(file_path, AuditorException::ExceptionType::MISSING))
AuditorException::ExceptionType::MISSING)) {
result = AuditorResult(AuditorResult::Type::RESULT_IGNORE); result = AuditorResult(AuditorResult::Type::RESULT_IGNORE);
}
break; break;
case AuditorResult::Type::ERROR_TEST_ANNOTATION: case AuditorResult::Type::ERROR_TEST_ANNOTATION:
if (IsSafeListed(result.file_path(), if (IsSafeListed(file_path,
AuditorException::ExceptionType::TEST_ANNOTATION)) { AuditorException::ExceptionType::TEST_ANNOTATION)) {
result = AuditorResult(AuditorResult::Type::RESULT_IGNORE); result = AuditorResult(AuditorResult::Type::RESULT_IGNORE);
} }
......
...@@ -73,4 +73,5 @@ and land the resulting CL. ...@@ -73,4 +73,5 @@ and land the resulting CL.
The following two lines will be updated by the above script, and the modified The following two lines will be updated by the above script, and the modified
README should be committed along with the updated .sha1 checksums. README should be committed along with the updated .sha1 checksums.
LASTCHANGE=571f573076431cc3c8c13da2d9b37841aee2d783-refs/heads/master@{#556683} CLANG_REVISION = '331747'
LASTCHANGE=5ebfed4cb2784625cbcccb588dc7e7bd9c87c9eb-refs/heads/master@{#557822}
5b26993a9fd2dcb3898ff7a28a35243cb13e9455 171bcdfa3a8354d517eaad35da26eb6750392c13
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment