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

Linter's html field support #455

Merged
merged 4 commits into from
Jul 15, 2016
Merged

Linter's html field support #455

merged 4 commits into from
Jul 15, 2016

Conversation

alygin
Copy link
Contributor

@alygin alygin commented Jul 8, 2016

Added support for the Linter's message html field via html_message.

fixes #428

@alygin
Copy link
Contributor Author

alygin commented Jul 8, 2016

@noseglid, could you, please, help me with this PR? It looks like the build and all tests are good but Travis is stalling for no obvious (at least for me) reason. Have you ever encountered such a problem in this project before? Or did I break something?

@@ -31,13 +31,15 @@ class Linter {
}
this.linter.setMessages(messages.map(match => ({
type: match.type || 'Error',
text: match.message || 'Error from build',
text: !match.message && !match.html_message ? 'Error from build' : match.message,
html: match.html_message,
Copy link
Owner

Choose a reason for hiding this comment

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

If message and html_message is set, it will set both to the linter which is an error.

Copy link
Contributor Author

@alygin alygin Jul 9, 2016

Choose a reason for hiding this comment

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

Yes, you're right. Here I saw two options: either we check it on our side and throw an error or let Linter make all the checks and throw errors. Now, other checks are made by Linter (for instance, that filePath is non-empty) so I decided to leave it this way. Although, if you think it must be the builder's responsibility to check the duplication, I'll add it. I think both attitudes have pros and cons and I have no strict preference other than being consistent in this question.

In case of duplication Linter throws the following error: 'Got both html and text fields on Linter Response, expecting only one'

Copy link
Contributor Author

@alygin alygin Jul 9, 2016

Choose a reason for hiding this comment

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

And, of course, there's a third option - just ignore either message or html_message when both are set. It will reduce quantity of errors seen by the end user, but it will also hide problems in the provider code. Maybe it's better to show an error and let the provider developer know that he or she did something wrong.

Some enhancement would be to ignore message if it equals to html_message and only use the latter. I think html_message must be preferred because in case of html-tags absence it behaves the same way as message.

What do you think?

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 think we should invoke the linter API incorrectly. Since message is the most used I think it should have precedence. So if both are set, don't send html_message to linter. Does that sound okay to you?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, that sounds reasonable as long as it is documented. I'll make the necessary changes.

Copy link
Owner

Choose a reason for hiding this comment

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

Awesome 👍

@noseglid
Copy link
Owner

noseglid commented Jul 9, 2016

I think it just stalled a little bit on travis's end. I restarted it and it passed. Sometimes weird stuff happens :)

@alygin
Copy link
Contributor Author

alygin commented Jul 10, 2016

Done with making message prioritized over html_message. Documentation and new tests are provided as well.

@noseglid
Copy link
Owner

Sorry for taking so long to finish this one off. Summer, y'know :)

This is a great PR. Thanks for the work you've put into this!

@noseglid noseglid merged commit 43b6844 into noseglid:master Jul 15, 2016
@alygin
Copy link
Contributor Author

alygin commented Jul 15, 2016

No worries at all. And thanks for merging! I hope build providers will make good use of the feature and come up with some cool stuff.

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.

html error text
2 participants