Rule keys with embedded semicolons cannot be parsed by the Issues Report plugin – or more specifically, the sonar v3.6+ org.sonar.api.rule.RuleKey's parse() method.
There are many rules in the R# ruleset that include colons. These will need to be changed to remove the colons, keeping the following in mind:
- rules are generated from the DefaultRules.ReSharper resource file. This file is generated from the R# tool itself (with one additional rule added) and for maintainability with future R# releases, should continue to have the raw output (ie: including the colons)
- the ReSharperRuleRepository class consumes the DefaultRules file to populate the plugin's rules in SonarQube (see createRules() method).
- the ReSharperProfileImporter class parses "exported" profile files, and is used by the ReSharperSonarWayProfile class to parse the DefaultRule file and populate the SonarWay profile.
- the ReSharperProfileExporter class exports the profile (for consumption by ProfileRuleImporter)
- users can provide their own rules (for use with custom R# plugins) using the "sonar.resharper.customRules.definition" property key (exposed via the settings web UI). This is consumed in the ReSharperRuleRepository.createRules() method
- the ReSharperResultsParser (which parses the inspectcode output) must be able to map the R# keys in the file to the colon-free versions in the SonarQube rules. These are used in the inner class MissingIssueTypeHelper.setIssueTypes
- The values logged from ReSharperResultParser.logMissingIssues() are intended to be copy/pasted into the "sonar.resharper.customRules.definition" property, so should include the R# rule key (with colons).
There is a helper class ReSharperRule which may be the best place to do the colon escaping/mapping. It isn't used everywhere currently, so additional refactorings would be needed.
When parsing the results file, you may find this guide helpful: http://www.wrightfully.com/parsing-resharper-inspectcode-results/
Specifically, when parsing the IssueTypes block, the rule key is in the attribute "Id". When parsing the Issues block, the rule key is in the "TypeId" attribute.