Skip to content

Commit

Permalink
#71
Browse files Browse the repository at this point in the history
fixed exclude filter
  • Loading branch information
ryaneberly committed Oct 7, 2015
1 parent 4f7763f commit d09453a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/main/java/com/cflint/tools/CFLintFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class CFLintFilter {

private JSONArray data = null;
private List<String> includeCodes = null;
private List<String> excludeCodes = null;
boolean verbose = false;

private CFLintFilter(final String data) {
Expand All @@ -29,6 +30,7 @@ private CFLintFilter(final String data) {
}
}

@Deprecated
public void addFilter(final Map<String,String> filter){
final JSONObject jsonObj = new JSONObject();
// for(Entry<String, String> entry: filter.entrySet()){
Expand All @@ -39,12 +41,9 @@ public void addFilter(final Map<String,String> filter){
public void excludeCode(final String ... codes){
if(codes.length == 0)
return;
Map<String, String> filter = new HashMap<String, String>();
for(String code: codes){
filter.put("code",code);
}
addFilter(filter);
excludeCodes = Arrays.asList(codes);
}

public void includeCode(final String ... codes){
if(codes.length == 0)
return;
Expand Down Expand Up @@ -98,6 +97,9 @@ public boolean include(final BugInfo bugInfo) {
if (includeCodes != null && !includeCodes.contains(bugInfo.getMessageCode())){
return false;
}
if (excludeCodes != null && excludeCodes.contains(bugInfo.getMessageCode())){
return false;
}
if (data != null) {
for (final Object item : data) {
final JSONObject jsonObj = (JSONObject) item;
Expand Down

0 comments on commit d09453a

Please sign in to comment.