Skip to content

Commit 0f96b45

Browse files
committed
Refactor SARIFAnalysisReport::addFinding() from 2 to 1 line!
Much thanks to @danmar for the tip :)
1 parent 7cf9157 commit 0f96b45

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

cli/sarifanalysisreport.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ SARIFAnalysisReport::SARIFAnalysisReport( std::string versionNumber)
2424
: mVersionNumber(std::move(versionNumber)) {}
2525

2626
void SARIFAnalysisReport::addFinding(const ErrorMessage &msg) {
27-
std::map<std::string, std::vector<ErrorMessage>>::iterator it = mFindings.insert(mFindings.begin(), {msg.id, std::vector<ErrorMessage>()});
28-
it->second.push_back(msg);
27+
mFindings[msg.id].push_back(msg);
2928
}
3029

3130
static std::map<std::string, picojson::value> text(const std::string& s) {

0 commit comments

Comments
 (0)