-
Notifications
You must be signed in to change notification settings - Fork 25
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
Prefer require_relative for internal requires #350
Prefer require_relative for internal requires #350
Conversation
e814665
to
40cb797
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #350 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 2 2
Lines 190 190
Branches 90 90
=========================================
Hits 190 190 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Would you mind actually adding something to the
if you fixup that change into the same commit I'll approve and merge! |
`require_relative` is preferred over `require` for files within the same project because it uses paths relative to the current file, making code more portable and less dependent on the load path. This change updates internal requires to use `require_relative` for consistency, performance, and improved portability. Ref: - ruby/psych#522 - ruby/logger#20 - ruby/rdoc#658 - panorama-ed#349 - rubocop/rubocop#8748
40cb797
to
c8c11f6
Compare
@JacobEvelyn done and force pushed in the same commit As a side note, for some extreme use cases, this can be considered a breaking change |
It is a potential breaking change for a use case that isn't actually a feature or intended. What he describes is a way to break the gem on purpose with knowledge of the source, so that you can hack a library in a very strange way. It is an interesting thought experiment. Several people have now responded to him on the RuboCop discussion. IMO it would be extreme to consider this a breaking change, especially since it fixes a real use case, which is benchmarking as this gem does. |
Yes I agree with both of these that this should not be considered a breaking change. |
As a side note, this change has been approved here by
@deivid-rodriguez
which is familiar with this issue: activeadmin/arbre#622require_relative
is preferred overrequire
for files within the sameproject because it uses paths relative to the current file, making code
more portable and less dependent on the load path.
This change updates internal requires to use
require_relative
forconsistency, performance, and improved portability.
Ref:
require_relative
for internal requires ruby/psych#522require_relative
rubocop/rubocop#8748Before merging:
Copy the table printed at the end of the latest benchmark results into theREADME.md
and update this PRIf this change merits an update toCHANGELOG.md
, add an entry following Keep a Changelog guidelines with semantic versioning