rubocop-rspec icon indicating copy to clipboard operation
rubocop-rspec copied to clipboard

Extract helper module for duplicate detection

Open Darhazer opened this issue 5 years ago • 1 comments

#994 would be the 5th cop that deals with repeated usage, and all the cops share similar structure for the detection: node.children.select { ... }.group_by { .... }.values.reject(&:one?).flat_map { repeated_lines }

It's time to extract a module for this and DRY the code

Darhazer avatar Aug 15 '20 15:08 Darhazer

The five cops are:

  1. RuboCop::Cop::RSpec::RepeatedExample
  2. RuboCop::Cop::RSpec::RepeatedExampleGroupBody
  3. RuboCop::Cop::RSpec::RepeatedExampleGroupDescription
  4. RuboCop::Cop::RSpec::RepeatedIncludeExample
  5. RuboCop::Cop::RSpec::ScatteredSetup

bquorning avatar Nov 10 '20 21:11 bquorning