Skip to content

Missing Cop for constant regexp? #151

Closed
@marcandre

Description

@marcandre

The following code has 3 anti-patterns:

def self.tokens(pattern)
   pattern.scan(TOKEN).reject { |token| token =~ /\A#{SEPARATORS}\Z/ }
end

This issue is to identify that /\A#{SEPARATORS}\Z/ should be isolated as a constant, since all it's dynamic components are constants.

See: rubocop/rubocop-ast#65

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions