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

Style/RedundantFileExtensionInRequire-20220926234015 #790

Merged
merged 3 commits into from
Sep 28, 2022

Conversation

github-actions[bot]
Copy link
Contributor

Rubocop challenge!

Style/RedundantFileExtensionInRequire

Safe autocorrect: Yes
✅ The autocorrect a cop does is safe (equivalent) by design.

Description

Overview

Checks for the presence of superfluous .rb extension in
the filename provided to require and require_relative.

Note: If the extension is omitted, Ruby tries adding '.rb', '.so',
and so on to the name until found. If the file named cannot be found,
a LoadError will be raised.
There is an edge case where foo.so file is loaded instead of a LoadError
if foo.so file exists when require 'foo.rb' will be changed to require 'foo',
but that seems harmless.

Examples

# bad
require 'foo.rb'
require_relative '../foo.rb'

# good
require 'foo'
require 'foo.so'
require_relative '../foo'
require_relative '../foo.so'

Auto generated by rubocop_challenger

@mathieujobin mathieujobin merged commit 892b9fa into master Sep 28, 2022
@mathieujobin mathieujobin deleted the rubocop-challenge/20220926234015 branch September 28, 2022 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant