Skip to content

Commit

Permalink
#114 rule groups support.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryaneberly committed Jan 30, 2017
1 parent 756e935 commit 8807d1c
Show file tree
Hide file tree
Showing 5 changed files with 440 additions and 214 deletions.
57 changes: 56 additions & 1 deletion src/main/java/com/cflint/config/CFLintPluginInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,19 @@
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

import com.cflint.config.CFLintPluginInfo.PluginInfoRule.PluginMessage;
import com.cflint.plugins.CFLintScanner;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;

@XmlRootElement(name = "CFLint-Plugin")
@JsonInclude(Include.NON_NULL)
public class CFLintPluginInfo {

List<PluginInfoRule> rules = new ArrayList<CFLintPluginInfo.PluginInfoRule>();
List<PluginInfoRule> rules = new ArrayList<CFLintPluginInfo.PluginInfoRule>();
List<RuleGroup> ruleGroups = new ArrayList<CFLintPluginInfo.RuleGroup>();

public List<PluginInfoRule> getRules() {
return rules;
Expand All @@ -27,6 +31,15 @@ public void setRules(final List<PluginInfoRule> rules) {
this.rules = rules;
}

public List<RuleGroup> getRuleGroups() {
return ruleGroups;
}

@XmlElement(name = "ruleGroup")
public void setRuleGroups(final List<RuleGroup> ruleGroups) {
this.ruleGroups = ruleGroups;
}

public PluginInfoRule getRuleByName(final String ruleName) {
for (final PluginInfoRule rule : rules) {
if (ruleName != null && ruleName.equals(rule.getName())) {
Expand All @@ -44,6 +57,47 @@ public String toString(){
return sb.toString();
}

@JsonInclude(Include.NON_NULL)
public static class RuleGroup {

public RuleGroup(String name) {
super();
this.name = name;
}
public RuleGroup() {
super();
}

String name;
List<PluginMessage> messages = new ArrayList<PluginMessage>();
String defaultSeverity;


public String getDefaultSeverity() {
return defaultSeverity;
}
@XmlAttribute(name = "defaultSeverity")
public void setDefaultSeverity(String defaultSeverity) {
this.defaultSeverity = defaultSeverity;
}
public String getName() {
return name;
}

@XmlAttribute(name = "name")
public void setName(String name) {
this.name = name;
}

public List<PluginMessage> getMessages() {
return messages;
}

@XmlElement(name = "message")
public void setMessages(final List<PluginMessage> messages) {
this.messages = messages;
}
}
@JsonInclude(Include.NON_NULL)
public static class PluginInfoRule {

Expand Down Expand Up @@ -181,6 +235,7 @@ public void setValue(final String value) {
}
}

@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class,property="code")
public static class PluginMessage {
String code;

Expand Down
Loading

0 comments on commit 8807d1c

Please sign in to comment.