Skip to content

Disable Rails/NegateInclude RuboCop rule

Evan Read requested to merge eread/disable-negate-include-rubocop-rule into main

What does this MR do and why?

RuboCop currently returns this offense:

lib/gitlab/docs/link.rb:32:35: C: [Correctable] Rails/NegateInclude: Use .exclude? and remove the negation part.
        @href.length.positive? && !@href.include?(':')

The code is: https://gitlab.com/gitlab-org/gitlab-docs/-/blob/10746a2df285f189242f8274f1d9cbcdbdbf48f4/lib/gitlab/docs/link.rb#L32.

The Rails/NegateInclude (https://docs.rubocop.org/rubocop-rails/cops_rails.html#railsnegateinclude) isn't relevant to a non-Rails project, and the string we use here doesn't have an .exclude? method:

Captain! We’ve been hit!

NoMethodError: undefined method `exclude?' for "/":String

  0. lib/gitlab/docs/link.rb:32:in `internal?'

Merge request acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports