Skip to content

Commit

Permalink
Use RESTRICT_ON_SEND for Style/RedundantCurrentDirectoryInPath
Browse files Browse the repository at this point in the history
  • Loading branch information
koic committed Mar 31, 2024
1 parent 97814aa commit 6165c97
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ class RedundantCurrentDirectoryInPath < Base
extend AutoCorrector

MSG = 'Remove the redundant current directory path.'
RESTRICT_ON_SEND = %i[require_relative].freeze
CURRENT_DIRECTORY_PATH = './'

def on_send(node)
return unless node.method?(:require_relative)
return unless (first_argument = node.first_argument)
return unless first_argument.str_content&.start_with?(CURRENT_DIRECTORY_PATH)
return unless (index = first_argument.source.index(CURRENT_DIRECTORY_PATH))
Expand Down

0 comments on commit 6165c97

Please sign in to comment.