Class: Dependabot::Bundler::FileFetcher::IncludedPathFinder

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/bundler/file_fetcher/included_path_finder.rb

Overview

Finds the paths of any files included using ‘require_relative` and `eval` in the passed file.

Instance Method Summary collapse

Constructor Details

#initialize(file:) ⇒ IncludedPathFinder

Returns a new instance of IncludedPathFinder.



19
20
21
# File 'lib/dependabot/bundler/file_fetcher/included_path_finder.rb', line 19

def initialize(file:)
  @file = file
end

Instance Method Details

#find_included_pathsObject

Raises:

  • (Dependabot::DependencyFileNotParseable)


24
25
26
27
28
29
# File 'lib/dependabot/bundler/file_fetcher/included_path_finder.rb', line 24

def find_included_paths
  result = Prism.parse(file.content)
  raise Dependabot::DependencyFileNotParseable, file.path if result.failure?

  find_require_relative_paths(result.value) + find_eval_paths(result.value)
end