forked from GoDaddy-Hosting/ruby-sonar-plugin
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCaneRulesRepository.java
More file actions
31 lines (25 loc) · 840 Bytes
/
CaneRulesRepository.java
File metadata and controls
31 lines (25 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package com.godaddy.sonar.ruby.metricfu;
import org.apache.commons.io.IOUtils;
import org.sonar.api.rules.Rule;
import org.sonar.api.rules.RuleRepository;
import org.sonar.api.rules.XMLRuleParser;
import com.godaddy.sonar.ruby.RubyPlugin;
import com.godaddy.sonar.ruby.core.Ruby;
import java.io.InputStream;
import java.util.List;
public class CaneRulesRepository extends RuleRepository {
public CaneRulesRepository() {
super(RubyPlugin.KEY_REPOSITORY_CANE, Ruby.KEY);
setName(RubyPlugin.NAME_REPOSITORY_CANE);
}
@Override
public List<Rule> createRules() {
XMLRuleParser parser = new XMLRuleParser();
InputStream input = CaneRulesRepository.class.getResourceAsStream("/com/godaddy/sonar/ruby/metricfu/CaneRulesRepository.xml");
try {
return parser.parse(input);
} finally {
IOUtils.closeQuietly(input);
}
}
}