Skip to content

Conversation

Arcanemagus
Copy link
Contributor

Add a JSON formatter option, allowing easier use in tools that have native modes of parsing this output.

@Arcanemagus Arcanemagus mentioned this pull request Jul 29, 2015
@steelbrain
Copy link

👍

@SimenB
Copy link

SimenB commented Aug 17, 2015

Publish it standalone on npm instead, then we can use it with the api & grunt (soon gulp as well hopefully) at least

@steelbrain
Copy link

@SimenB we have a working fork here, You can use it until this is merged, You'll have to point npm at git+https though. https://github.com/AtomLinter/csslint

@Arcanemagus
Copy link
Contributor Author

Any chance that this could be merged or at least reviewed? I would absolutely love to get rid of AtomLinter/csslint and switch AtomLinter/linter-csslint back to this official repository now that it seems to be active again, however without this PR I can't do that yet.

@Arcanemagus
Copy link
Contributor Author

Are there any changes that need to be made before this can be merged in @frvge?

@frvge
Copy link
Contributor

frvge commented Jan 20, 2016

@Arcanemagus , I'm currently doing mostly quick triages to try to get the project alive again. At first sight your PR looks good. I'll add triage to get some other collaborator's opinion.

@frvge frvge added the Triage label Jan 20, 2016
@Arcanemagus
Copy link
Contributor Author

bump (I really want to get rid of the fork....)

Assert.areEqual("{\"messages\":[],\"stats\":[]}", actual);
},

"Should have no output when quiet option is specified and no errors": function() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't you define errors & warnings in your result object to test if quiet has an effect?
What happens if I set quiet: "false" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand what you are asking here.

The way JSON.stringify works means that the result object being passed in there would still be output of {"messages":[],"stats":[]} if quiet is not true.

Formatters have nothing to do with parsing the options, if csslint isn't sending in a properly valued quiet option that's a bug in the rest of csslint, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, I just realized what you mean, and that's a silly bug, fixing.

*/
formatResults: function(results, filename, options) {
"use strict";
return options.quiet && results.messages.length < 1 ? "" : JSON.stringify(results);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jshint complains about JSON being unavailable, and it looks like rightfully so as one of the supported platforms is WSH, which may or may not have this defined, depending on the version being run.

I'm not sure how to solve this though, any pointers?

@Arcanemagus
Copy link
Contributor Author

Added a commit specifying JSON as a global variable. This is fine in Node.js and Rhino, but can potentially cause issues in WSH as it is only available from JScript 5.8 onwards. It seems actually using JScript 5.8 though can be quite the pain.

As the WSH interface is currently not supported, whether this is an issue or not I'll leave to you guys.

@Arcanemagus
Copy link
Contributor Author

Also as a note: None of the other formatters actually test if they properly output messages if there are ones to display and --quiet has been specified... of the ones that even support/test that functionality in the first place!

Add a JSON formatter option, allowing easier use in tools that have
native modes of parsing this output.
@Arcanemagus
Copy link
Contributor Author

Any further changes? Comments?

@frvge
Copy link
Contributor

frvge commented Mar 1, 2016

@XhmikosR I re-ran the tests to verify an issue with another PR and it looks like travis is having issues. Do you know anything about that?

@XhmikosR
Copy link
Member

XhmikosR commented Mar 1, 2016

@frvge: it's a known issue with node.js 5.7.0. 5.7.1 should be out today or so, so it will be fixed.

@Arcanemagus
Copy link
Contributor Author

Btw, working on incorporating proper multiple file support here.

@Arcanemagus
Copy link
Contributor Author

There, should properly handle multiple files now. If there are any changes required please let me know. (Should I be updating the dist files?)

Output results even if options.quiet is true. Adds a test to verify that
this is working properly.
Results from multiple files should be handled in a single JSON object
instead of output as multiple objects.
@Arcanemagus
Copy link
Contributor Author

Any further changes that need to be made?

@Arcanemagus
Copy link
Contributor Author

Are there any issues still needing to be resolved here?
Is this blocked due to the specific WSH version requirement?

If this PR and #605 weren't forcing linter-csslint to use a custom (unmaintained!) fork of csslint I would have long ago abandoned this...

@Arcanemagus
Copy link
Contributor Author

Bump...

@frvge
Copy link
Contributor

frvge commented Mar 24, 2016

@XhmikosR ? I think it looks good.

@frvge frvge removed the Triage label Mar 29, 2016
@XhmikosR XhmikosR added this to the 1.0.0 milestone Apr 4, 2016
@XhmikosR XhmikosR merged commit 6334170 into CSSLint:master Apr 4, 2016
@Arcanemagus Arcanemagus deleted the json-formatter branch April 4, 2016 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants