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

Don't output table if no violations are specified #116

Merged
merged 5 commits into from
Jan 29, 2017

Conversation

mxstbr
Copy link
Member

@mxstbr mxstbr commented Jan 29, 2017

Right now when using fail just to fail the build, but not to output
any information (i.e. just using fail()), Danger outputs an empty
table with a message of "undefined", which is annoying. (see #109 for
context)

I think this fixes it, but I'm not sure if it's the right fix and/or
if there's a better way to do it. Please let me know!

Right now when using `fail` just to fail the build, but not to output
any information (i.e. just using `fail()`), Danger outputs an empty
table with a message of "undefined", which is annoying. (see danger#109 for
context)

I _think_ this fixes it, but I'm not sure if it's the right fix and/or
if there's a better way to do it. Please let me know!
Copy link
Member

@orta orta left a comment

Choose a reason for hiding this comment

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

Conceptually 👍
Feature seems solid to me, only some minor nitpicks

@@ -11,7 +11,7 @@ import * as v from "voca"
* @returns {string} HTML
*/
function table(name: string, emoji: string, violations: Array<Violation>): string {
if (violations.length === 0) { return "" }
if (violations.length === 0 || (violations.length === 1 && !violations[0].message)) { return "" }
Copy link
Member

Choose a reason for hiding this comment

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

Lets get a test on this logic, as this is not something which would get manually tested very often

Copy link
Member

Choose a reason for hiding this comment

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

This area is already pretty well covered, so it should be pretty trivial to C&P an existing one

@@ -2,11 +2,13 @@

// Add your own contribution below

* Add support for failing the build without outputting any text - mxstbr
Copy link
Member

Choose a reason for hiding this comment

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

This should probably be something more like:

Builds which only use markdown now only show the markdown, and no violations table is shown - mxstbr

Which makes a bit more sense without the context of this PR 👍

@mxstbr
Copy link
Member Author

mxstbr commented Jan 29, 2017

I just realised that this would still show a table in this case:

fail()
fail()

Which doesn't make sense. Will update, one sec.

@macklinu
Copy link
Member

@mxstbr haha I was just about to comment on that potential edge case - nice catch! 😄

@mxstbr
Copy link
Member Author

mxstbr commented Jan 29, 2017

Done, take a look and let me know!

Copy link
Member

@macklinu macklinu left a comment

Choose a reason for hiding this comment

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

Looking good to me, thanks for this fix! I'll let @orta take a look and perhaps we can get a patch version released soon (I'm not sure how to do this/if I have the permissions to publish danger-js to npm).

@orta
Copy link
Member

orta commented Jan 29, 2017

@macklinu I'd love to give you permission to push

@@ -11,7 +11,7 @@ import * as v from "voca"
* @returns {string} HTML
*/
function table(name: string, emoji: string, violations: Array<Violation>): string {
if (violations.length === 0) { return "" }
if (violations.length === 0 || violations.every(violation => !violation.message)) { return "" }
Copy link
Member

Choose a reason for hiding this comment

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

cool, the every function is new to me

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I've only known it for a few weeks! (there's also some FYI)

@orta orta merged commit 5c10c75 into danger:master Jan 29, 2017
@orta
Copy link
Member

orta commented Jan 29, 2017

My rule of thumb on releasing is roughly every 2-3 PRs, I have zero problems with every PR, assuming every PR is big enough to warrant the ~2 minutes to deploy

@orta
Copy link
Member

orta commented Jan 29, 2017

screen shot 2017-01-29 at 2 08 59 pm

@mxstbr mxstbr deleted the fix-fails branch January 30, 2017 09:05
@mxstbr
Copy link
Member Author

mxstbr commented Jan 30, 2017

I have zero problems with every PR, assuming every PR is big enough to warrant the ~2 minutes to deploy

That sounds like the perfect use case for semantic-release 😉

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.

3 participants