Project

General

Profile

Actions

Patch #38093

closed

Use require_relative instead of generating the full path for a file

Added by Go MAEDA over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Code cleanup/refactoring
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:

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'

Files

require_relative.patch (201 KB) require_relative.patch Go MAEDA, 2022-12-23 06:53
Actions #1

Updated by Go MAEDA over 1 year ago

  • Target version set to 5.1.0

Setting the target version to 5.1.0.

Actions #2

Updated by Go MAEDA over 1 year ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA

Committed the patch.

Actions #3

Updated by Go MAEDA over 1 year ago

  • Subject changed from Use `require_relative` instead of `require File.expand_path(..., __FILE__)` to Use require_relative instead of generating the full path for a file
Actions

Also available in: Atom PDF