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

[wip] Improve handling missing coverage info #37

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions lib/danger_plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,16 @@ class DangerXcov < Plugin
# @return [void]
#
def report(*args)
# Run xcov to produce a processed report
report = produce_report(*args)
# Output the processed report
output_report(report)
begin
# Run xcov to produce a processed report
report = produce_report(*args)
# Output the processed report
output_report(report)
rescue => e
markdown("Xcov not run due to error: #{e}")
Copy link
Author

Choose a reason for hiding this comment

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

warn or fail is more appropriate than markdown method. Also, I had some string encoding issues with displaying the error... Maybe better to leave it out?

Xcov not run due to error: �[31mError creating your coverage report - see the log above�[0m

Copy link
Author

Choose a reason for hiding this comment

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

@nakiostudio @joshdholtz @ffittschen How do you think the error should be handled? I think rescuing a specific error type would make this plugin brittle and break functioning whenever xcov changes, but what do you think of outputting a generic error thusly:

error("Xcov-danger could not run")

Having the error info would make it easier to fix the problem, but I'm not sure where the string encoding issues are coming from...

end
end

# Produces and processes a report for use in the report method
# It takes the same arguments as report, and returns the same
# object as process_report
Expand Down