Skip to content
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

Return empty json array when Sass-Lint runs successfully but finds no issues. #658

Open
mikesive opened this issue Apr 28, 2016 · 5 comments

Comments

@mikesive
Copy link

mikesive commented Apr 28, 2016

Is it possible to do this? Otherwise I don't know if sass-lint has run or not as it won't create an empty output file.

@DanPurdy
Copy link
Member

DanPurdy commented Apr 28, 2016

We can definitely look to do this, unfortunately your PR didn't cater for the majority of users who don't use output files for their results.

To implement you'd need to make sure the user has chosen to output the results to a file first and then check if the results are empty or not.

Also with the different formatters we use it couldn't just be JSON format if for example the user has html output..

Sass-lint always throws error or exit codes so you can check for those and also if your task is setup then the lack of an output file would indicate your linting was fine? Or is there a worry that Sass-lint may not have run for you?

@DanPurdy
Copy link
Member

DanPurdy commented Apr 28, 2016

Also there were specific steps taken to silence the output on the event of no warnings/errors before #141 so I'm not sure whether this would contradict that. @sasstools/sass-lint-contributors thoughts?

@mikesive
Copy link
Author

I just have a specific use case where I need it to write out an empty JSON array to the ouput file. What is the exit code if the linter actually fails to run as opposed to if it finds errors?

@tommycoppers
Copy link

I was looking into this as well. I was going to submit a PR that would remove the if block in the outputResults() method (

if (this.resultCount(results)) {
). Then I came across issue #141 . It wouldn't quite reverse that PR completely, but it would be slightly contradictory.

I just spent a fair amount of time trying to debug why ignoring a file was still showing a warning in the output, before I realized that the output was never being updated. It wasn't being updated because all the warnings/errors were addressed. Some sort of feedback that there were 0 errors would have prevented my witch hunt.

I'd love to contribute, if you all believe consistent outputting would be a worthwhile feature. I definitely believe it is.

@DanPurdy
Copy link
Member

@tommycoppers that's an interesting occurrence, I can see both sides of the argument. Maybe it's a case that output files should still be written but the console should remain silent on no errors. This wouldn't be hard to implement at all in the area you highlighted, I'd be happy to get PR's for this if you feel it's the way to go or we can discuss a better approach?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants