Skip to content

Commit 2bd9f64

Browse files
committed
csgrep --remove-duplicates: use the same message filters as csdiff
This can be used to deduplicate reports whose messages are not identical but semantically equivalent.
1 parent 960c07a commit 2bd9f64

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/csgrep.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include "abstract-parser.hh"
2121
#include "abstract-filter.hh"
22+
#include "csfilter.hh"
2223
#include "cswriter.hh"
2324
#include "json-writer.hh"
2425
#include "regex.hh"
@@ -352,7 +353,11 @@ class DuplicateFilter: public AbstractFilter {
352353

353354
protected:
354355
virtual bool matchDef(const Defect &def) {
355-
const DefEvent &evt = def.events[def.keyEventIdx];
356+
DefEvent evt = def.events[def.keyEventIdx];
357+
358+
// abstract out differences we do not deem important
359+
evt.msg = MsgFilter::inst()->filterMsg(evt.msg, def.checker);
360+
356361
return lookup_.insert(evt)./* inserted */second;
357362
}
358363

0 commit comments

Comments
 (0)