r7kamura / rspec-json_matcher

RSpec matcher for testing JSON string
MIT License
171 stars 10 forks source link

Style/ExpandPathArguments-20220512230548 #17

Closed github-actions[bot] closed 2 years ago

github-actions[bot] commented 2 years ago

Rubocop challenge!

Style/ExpandPathArguments

Safe autocorrect: Yes :white_check_mark: The auto-correct a cop does is safe (equivalent) by design.

Description

Overview

This cop checks for use of the File.expand_path arguments. Likewise, it also checks for the Pathname.new argument.

Contrastive bad case and good case are alternately shown in the following examples.

Examples

# bad
File.expand_path('..', __FILE__)

# good
File.expand_path(__dir__)

# bad
File.expand_path('../..', __FILE__)

# good
File.expand_path('..', __dir__)

# bad
File.expand_path('.', __FILE__)

# good
File.expand_path(__FILE__)

# bad
Pathname(__FILE__).parent.expand_path

# good
Pathname(__dir__).expand_path

# bad
Pathname.new(__FILE__).parent.expand_path

# good
Pathname.new(__dir__).expand_path

Auto generated by rubocop_challenger