rubocop-rspec
rubocop-rspec copied to clipboard
Extract helper module for duplicate detection
#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
The five cops are:
RuboCop::Cop::RSpec::RepeatedExampleRuboCop::Cop::RSpec::RepeatedExampleGroupBodyRuboCop::Cop::RSpec::RepeatedExampleGroupDescriptionRuboCop::Cop::RSpec::RepeatedIncludeExampleRuboCop::Cop::RSpec::ScatteredSetup