Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint/DuplicateRequire doesn't distinguish between require and require_relative #8627

Closed
tas50 opened this issue Sep 1, 2020 · 0 comments · Fixed by #8631
Closed

Lint/DuplicateRequire doesn't distinguish between require and require_relative #8627

tas50 opened this issue Sep 1, 2020 · 0 comments · Fixed by #8631
Labels

Comments

@tas50
Copy link
Contributor

tas50 commented Sep 1, 2020

Expected behavior

Lint/DuplicateRequire should not consider a require and a require_relative with the same name to be the same require.

Actual behavior

Require and require_relative with the same name are considered duplicate when they are not.

Steps to reproduce the problem

Scan this:

require 'toml'
require 'json'

require_relative 'api'
require_relative '_common'
require_relative 'toml'
/Users/tsmith/dev/the_world/gitlab-ci-runner/libraries/runner.rb:24:1: W: Lint/DuplicateRequire: Duplicate require_relative detected.
require_relative 'toml'
^^^^^^^^^^^^^^^^^^^^^^^

RuboCop version

0.90.0 (using Parser 2.7.1.4, rubocop-ast 0.3.0, running on ruby 2.7.1 x86_64-darwin19)
@koic koic added the bug label Sep 1, 2020
koic added a commit to koic/rubocop that referenced this issue Sep 2, 2020
Fixes rubocop#8627.

This PR fixes a false positive for `Lint/DuplicateRequire` when same feature
argument but different require method.
@koic koic closed this as completed in #8631 Sep 2, 2020
koic added a commit that referenced this issue Sep 2, 2020
…ate_require

[Fix #8627] Fix a false positive for `Lint/DuplicateRequire`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants