Skip to content

Commit

Permalink
Make filter for issues from one tool possible
Browse files Browse the repository at this point in the history
- add repository (tool) key as tag to make it possible to filter in issues by tool (tag must be a-z,0-9,-,+)
- correct clang repository keys: lower case
- close #SonarOpenCommunity#1922
  • Loading branch information
guwirth committed Aug 24, 2020
1 parent 29a7a9d commit ddf9e81
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
public class CxxClangSARuleRepository extends RulesDefinitionXml {

private static final String LANGUAGE = "cxx";
public static final String KEY = "ClangSA";
public static final String KEY = "clangsa";
private static final String NAME = "Clang-SA";
private static final String FILE = "/clangsa.xml";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
public class CxxClangTidyRuleRepository extends RulesDefinitionXml {

private static final String LANGUAGE = "cxx";
public static final String KEY = "ClangTidy";
public static final String KEY = "clangtidy";
private static final String NAME = "Clang-Tidy";
private static final String FILE = "/clangtidy.xml";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ public void define(Context context) {
LOG.info("Cannot Load XML '{}'", e);
}
}

// add repository key as tag to make it possible to filter in issues by tool (tag must be a-z,0-9,-,+)
String tag = repositoryKey.toLowerCase().replaceAll("[^a-z0-9-+]", "-");
for (NewRule rule : repository.rules()) {
rule.addTags(tag);
}
}

repository.done();
Expand Down

0 comments on commit ddf9e81

Please sign in to comment.