-
Notifications
You must be signed in to change notification settings - Fork 3
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
Create undercover-report command #3
Conversation
IMO I prefer the original once, the differences between each solution is only the Also, I guess we can use so 1️⃣ undercover -c origin/development > coverage/undercover.txt vs 2️⃣ undercover-report -c origin/development I prefer the 1️⃣ solution |
Thank you @andyduong1920. As you know the first initiative was
Absolutely, we can do that. Everything from undercover is still available. Also, I created an issue in undercover for a Let me know your thoughts :) |
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 don't share the opinion of @andyduong1920 on this as I prefer this version in the sense that it favours convention (using a default path) while still allowing custom configuration to be passed. In the end, it's simpler to use.
let!(:file) { File.join(Dir.getwd, 'coverage/undercover.txt') } | ||
|
||
before(:each) do | ||
allow(described_class).to receive(:`).and_return(mock_message) |
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.
What is receive(:
)` for?
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.
receive(:
)` is to mock the -
undercover #{args&.join(' ')}
CLI command output.
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.
Wow, I would not have guessed. So a comment would help future devs, yourself included.
lib/undercover/plugin.rb
Outdated
@@ -23,15 +23,15 @@ class DangerUndercover < Plugin | |||
# If there are reports then it shows the report as a warning in danger. | |||
# @return [void] | |||
# | |||
def report(undercover_path, sticky: true) | |||
def report(undercover_path = 'coverage/undercover.txt', sticky: true) |
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.
One minor improvement for code discovery would be to have a constant for this:
DEFAULT_PATH = 'coverage/undercover.txt'.freeze
def report(undercover_path = DEFAULT_PATH, sticky: true)
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.
Fixed in 8bd4983
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.
Please add some extra comment for the specs. The rest looks good to me.
What happened 👀
The previous method to create the report
undercover -c $compare_git_ref > coverage/undercover.txt
was not so user friendly.Insight 📝
To fix this we created a new CLI command
undercover-report
which takes the same arguments asundercover
and saves the output in a file for thedanger-undercover
to read from.undercover-report -c origin/development
Proof Of Work 📹
Tested the implementation in our internal project and it's working seamlessly 🤩