-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6984217
commit 206961b
Showing
5 changed files
with
72 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/main/java/com/cflint/plugins/exceptions/CFLintExceptionListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.cflint.plugins.exceptions; | ||
|
||
public interface CFLintExceptionListener { | ||
|
||
public void exceptionOccurred(Exception exception, String messageCode, String filename, Integer line, | ||
Integer column, String functionName, String expression); | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/com/cflint/plugins/exceptions/DefaultCFLintExceptionListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.cflint.plugins.exceptions; | ||
|
||
import com.cflint.BugInfo; | ||
import com.cflint.BugList; | ||
import com.cflint.BugInfo.BugInfoBuilder; | ||
|
||
/** | ||
* Default listener which treats Linter errors (file reading, and parsing) as bugs. | ||
* @author ryaneberly | ||
* | ||
*/ | ||
public class DefaultCFLintExceptionListener implements CFLintExceptionListener { | ||
|
||
BugList bugs; | ||
|
||
public void exceptionOccurred(final Exception exception, final String messageCode, final String filename, | ||
final Integer line, final Integer column, final String functionName, final String expression) { | ||
final BugInfoBuilder bugInfoBuilder = new BugInfo.BugInfoBuilder(); | ||
bugInfoBuilder.setMessageCode(messageCode).setFilename(filename) | ||
.setSeverity("ERROR"); | ||
if("PARSE_ERROR".equals(messageCode)){ | ||
bugInfoBuilder.setMessage("Unable to parse"); | ||
}else{ | ||
bugInfoBuilder.setMessage(exception.getMessage()); | ||
} | ||
bugInfoBuilder.setExpression(expression); | ||
bugInfoBuilder.setFunction(functionName); | ||
bugs.add(bugInfoBuilder.build()); | ||
} | ||
|
||
} |