Patch #38093
Use require_relative instead of generating the full path for a file
Status: | Closed | Start date: | ||
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | % Done: | 0% | ||
Category: | Code cleanup/refactoring | |||
Target version: | 5.1.0 |
Description
In the code of Redmine, you can find many require
methods that builds the absolute path of a file using File.expand_path
and __FILE__
:
require File.expand_path('../../test_helper', __FILE__)
I think using `require_relative` can make those simpler and more readable, as shown below.
require_relative '../test_helper'
Associated revisions
Use `require_relative` instead of `require File.expand_path(..., FILE)` (#38093).
Patch by Go MAEDA.
Use `require_relative` instead of `File.dirname(FILE) + ...` (#38093).
Patch by Go MAEDA.
History
#1
Updated by Go MAEDA about 1 month ago
- Target version set to 5.1.0
Setting the target version to 5.1.0.
#2
Updated by Go MAEDA about 1 month ago
- Status changed from New to Closed
- Assignee set to Go MAEDA
Committed the patch.