[go: up one dir, main page]

Danger: Ensure that Dangerfiles have test coverage

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Problem

We've seen an incident in #412442 (closed) where Danger failed due to a bug in Dangerfile.

Proposed solution

Static analysis

Create a rule to only allow calls to Danger plugins and flag any other code.

In a danger/**/Dangerfile:

# bad
return if helper.ci?

MESSAGE = "Some message"

markdown MESSAGE
# good
# Create and test Danger::MyMessage plugin
my_message.send_message

Runtime

This feels like a maintenancetest-gap.

🅰️ I wonder if code coverage could help here.

  1. Run danger with code coverage enabled
  2. Ensure that changed (in this MR) Dangerfiles have a code coverage of 100%.

🅱️ Alternative solution is to ensure that all Dangefiles are covered by specs. This could be achieved by:

  1. Move all logic from Dangerfiles tooling/ and add specs.
  2. Add specs to utilize Dangerfile files.

3️⃣

Edited by 🤖 GitLab Bot 🤖