-
Notifications
You must be signed in to change notification settings - Fork 27
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
support Jenkins-status: UNSTABLE #16
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the pull request! The feature and UI look good.
I've added a couple of comments. Will you please also add a test case?
@@ -135,4 +136,4 @@ def get_jenkins_build_health(build) | |||
Builds::BUILD_LIST.each do |build| | |||
send_event(build['id'], get_build_health(build)) | |||
end | |||
end | |||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like having new lines at the ends of files 😄 Sorry, don't have any linting set up.
@@ -123,7 +124,7 @@ def get_jenkins_build_health(build) | |||
latest_build = builds_with_status.first | |||
return { | |||
name: latest_build['fullDisplayName'], | |||
status: latest_build['result'] == 'SUCCESS' ? SUCCESS : FAILED, | |||
status: latest_build['result'] == 'SUCCESS' ? SUCCESS : latest_build['result'] == 'UNSTABLE' ? UNSTABLE : FAILED, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find nested ternaries to be very difficult to read. What about something like:
jenkins_statuses = { 'SUCCESS' => SUCCESS, 'UNSTABLE' => UNSTABLE }
# ...
status: jenkins_statuses[latest_build['result']] || FAILED
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the comments :) make sense.
I'll commit changes later when I have more time or feel free to adjust to your wishes! 👍
looks like: