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

provide exit code for integration with other processes #7

Closed
wants to merge 5 commits into from
Closed

provide exit code for integration with other processes #7

wants to merge 5 commits into from

Conversation

mufasa71
Copy link

No description provided.

@jo-sm
Copy link
Owner

jo-sm commented Feb 28, 2017

Hi, sorry I haven't had a chance to look at this. I'll look at this soon!

@jo-sm
Copy link
Owner

jo-sm commented Apr 13, 2017

Hi @Mukimov, I just pushed a big change to stylelint_d, which changed the handling of warnings, etc. internally. Can you rebase and update the PR to add the return code into the new code?

lib/server.js Outdated
// the directories contain multiple configs (I think this is also a bug
// in stylelint)
console.info(`Changing process directory to ${folder}`);
process.chdir(folder);
Copy link
Author

Choose a reason for hiding this comment

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

I removed this part. You can check it with 'vanilla' stylelint output, it is different with stylelint_d output. I think it should be the same.

Copy link
Owner

Choose a reason for hiding this comment

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

I don't understand, do you mean the file glob or the console.info?

Copy link
Author

@mufasa71 mufasa71 Apr 17, 2017

Choose a reason for hiding this comment

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

I mean process.chdir
Here is "vanilla" stylelint project/styles/button.scss output:

project/styles/components/button.scss
  248:3  ×  Expected height to come before margin-right   order/properties-alphabetical-order

And stylelint_d project/styles/button.scss output:

button.scss
 248:3  ×  Expected height to come before margin-right   order/properties-alphabetical-order

File path is not the same as in stylelint output.

Copy link
Owner

Choose a reason for hiding this comment

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

Oh I see. Good point, but I think it's outside the scope of this PR, so I made a separate issue: #8.

Copy link
Author

Choose a reason for hiding this comment

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

@jo-sm Thanks! )

lib/server.js Outdated
@@ -173,8 +173,7 @@ function connHandler(conn) {
if (formatter === 'string') {
// If the formatter is a string, we just send the raw output
// from stylelint, since it's formatted for us already.
result = data.output;
write(conn, result);
write(conn, JSON.stringify(data));
Copy link
Owner

@jo-sm jo-sm Apr 16, 2017

Choose a reason for hiding this comment

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

I'd feel more comfortable if we didn't use JSON.stringify on the plain data, since if the resulting data is too large it could cause issues for JSON.stringify, and rather sent split up like we do below, that way we get around any issues JSON.stringify may have with this data.

Copy link
Author

Choose a reason for hiding this comment

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

Got it, will update PR!

@@ -53,7 +53,7 @@ if (args.stdin) {

function lint(args) {
var command = args._[0];
var format = args.formatter;
var format = args.formatter || 'string';
Copy link
Owner

Choose a reason for hiding this comment

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

We don't want to assume a format here since the format assumption is taken care of in server.js.

Copy link
Author

Choose a reason for hiding this comment

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

But default format in stylelint is string, So usually people wants string output, not json.

Copy link
Owner

Choose a reason for hiding this comment

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

Ah sorry, that was ambiguous. The default formatter, which is string, is handled in server.js, not in stylelint_d.js. For now, this is okay.

});

if (result.some(function(d) { return d.errored; })) {
process.exitCode = 1;
Copy link
Owner

@jo-sm jo-sm Apr 16, 2017

Choose a reason for hiding this comment

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

It looks like stylelint returns specific error codes for specific reasons, so we should try to follow those as well:

1: Something unknown went wrong.
2: At least one rule with an "error"-level severity triggered at least one warning.
78: There was some problem with the configuration file.
80: A file glob was passed, but it found no files.

Copy link
Author

Choose a reason for hiding this comment

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

Good point, will do it

@jo-sm
Copy link
Owner

jo-sm commented Nov 25, 2017

Hi @Mukimov, I'm really sorry for not replying back after your changes. A few things have changed since April when the last commit here was, and I'm planning to get this added in the next week or so. I will send a message here when it's complete so you can test it out and review it. I'll also see what I can do about assigning credit in the commit(s) so that you are attributed properly as a contributor to the repository.

@jo-sm
Copy link
Owner

jo-sm commented Dec 12, 2017

Hello @Mukimov I created a new PR (#12) with some updated code that handles exit codes. Can you take a look? I am closing this in favor of that PR.

@jo-sm jo-sm closed this Dec 12, 2017
@jo-sm
Copy link
Owner

jo-sm commented Dec 12, 2017

I will merge the other PR in one week if I don't hear anything.

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

Successfully merging this pull request may close these issues.

2 participants