Skip to content

Rails/NegateInclude is not safe for auto correction  #384

Closed
@adamcooke

Description

We cannot assume that everything that implements include? also implements exclude?. While Rails does add this to some things, it doesn't add them to everything and making this assumption is dangerous.

For example, IPAddr (in stdlib) has an include? method but does not have an exclude?.

Expected behaviour

Inserting !something.include?(x) should not correct to something.exclude?(x).

Actual behavior

It was corrected.

RuboCop version

$ [bundle exec] rubocop -V
1.3.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions