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

Add new Lint/DuplicateRequire cop #8474

Merged
merged 1 commit into from Aug 12, 2020

Conversation

fatkodima
Copy link
Contributor

This cop checks for duplicate requires and require_relatives.

I ran it on 30k files and it detected 13 offenses, so looks useful.

This cop does not detect cases like require 'foo' vs require './foo' and the like. Looks like those will be very rare cases and not sure if it is worth the complexity.

@bbatsov
Copy link
Collaborator

bbatsov commented Aug 7, 2020

One thing to keep in mind is that some requires might be conditional (e.g. in some if, instead at the top-level), but those cases are rare and we probably shouldn't worry about them too much.

@marcandre marcandre merged commit 764fcf5 into rubocop:master Aug 12, 2020
@marcandre
Copy link
Contributor

Good stuff, thanks! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants