Skip to content

Files

Latest commit

 

History

History
26 lines (17 loc) · 475 Bytes

Style-Dir.md

File metadata and controls

26 lines (17 loc) · 475 Bytes

Pattern: Missing use of __dir__

Issue: -

Description

This rule checks for places where the #__dir__ method can replace more complex constructs to retrieve a canonicalized absolute path to the current file.

Examples

# bad
path = File.expand_path(File.dirname(__FILE__))

# bad
path = File.dirname(File.realpath(__FILE__))

# good
path = __dir__

Further Reading