-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plain Reporter prints Error Message for result even if there are no errors #14
Comments
Hi, I'm glad to hear you find the task useful! Specifically, what 'non-error' result data would you expect to see? Currently a Phil |
Oh, I'm thinking you'd just like to see an exact list of the files which were actually validated right? |
Right, I'd like to either see no data or a success message. Just to make sure I'm not communicating poorly: I have 10 js files. 5 of them have errors. I run jshint on all 10. The plain reporter prints the getFileFailure message ("JSHint validation failed for " + file;) for all the files (10 times), which isn't correct for 5 of the files. Instead it should either print out only the message for the 5 files that fail or print out 5 success messages and 5 failure messages. for(JsHintResult result : report.getResults()) {
if(result.getNumErrors() > 0) { //print error results
output.append("\n");
output.append(getFileFailureMessage((result.getFile()) + "\n"));
for(JsHintError error : result.getErrors()) {
output.append(getIssueMessage(error.getReason(), error.getEvidence(), error.getLine(), error.getCharacter()) + "\n");
}
} else {
//optionally print a success message for this result
}
} |
philmander#14 was reported by me. I specified the code change in a comment and then decided to try to fix it.
philmander#14 was reported by me. I specified the code change in a comment and then decided to try to fix it.
philmander#14 was reported by me. I specified the code change in a comment and then decided to try to fix it.
The above code block is from https://github.com/philmander/ant-jshint/blob/master/src/main/java/com/philmander/jshint/report/PlainJsHintReporter.java
When the reporter runs, it just checks once if the entire report has errors and then assumes all results are errors. It would be nice to have logic that distinguishes results with errors from results with successes. I.e. : if(results.getNumErrors() > 0) { error logic } else { success logic }
This might be nice for some of the xml reporters as well but they don't write language that indicates an error but rather just print out all result files by name with no error report. The PlainJsHintReporter uses the getFileFailureMessage every time, no matter if the individual file failed or not, which is confusing.
Thank you very much for this library, it is by far the easiest way to get JSHint integrated into a build system on multiple platforms (windows and linux). I'm using it through Gradle and it works wonderfully.
The text was updated successfully, but these errors were encountered: