debian-mirror-gitlab/tooling/danger/specs/match_with_array_suggestion.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
509 B
Ruby
Raw Normal View History

2023-06-20 00:43:36 +05:30
# frozen_string_literal: true
require_relative '../suggestion'
module Tooling
module Danger
module Specs
class MatchWithArraySuggestion < Suggestion
MATCH = /(?<to>to\(?\s*)(?<matcher>match|eq)(?<expectation>[( ]?\[(?=.*,)[^\]]+)/
REPLACEMENT = '\k<to>match_array\k<expectation>'
SUGGESTION = <<~SUGGEST_COMMENT
If order of the result is not important, please consider using `match_array` to avoid flakiness.
SUGGEST_COMMENT
end
end
end
end