Skip to content

Extend match_array danger rule with more use-cases

Context

Closes #381702 (closed)

The following code is currently caught by Danger:

# Will suggest to use `match_array`
expect(foo).to match(['bar'])

# Will suggest to use `match_array`
expect(foo).to match([
  'bar3'
])

Not the following code:

# Will not suggest to use `match_array`
expect(foo).to match(
  ['bar']
)

This caused a master-broken incident recently.

What does this MR do?

Ensures that Danger catches those use-cases.

Screenshots or screen recordings

Before

Screenshot_2022-11-07_at_16.30.05

After

Screenshot_2022-11-07_at_16.30.26

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by David Dieulivol

Merge request reports

Loading