Class: RSpec::Risky::StaticDetector

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/risky/static_detector.rb,
sig/rspec/risky.rbs

Defined Under Namespace

Classes: Finding

Constant Summary collapse

ASSERTION_METHODS =
%w[assert expect refute].freeze
OUTPUT_METHODS =
%w[p print printf puts warn].freeze
TEST_METHODS =
%w[it scenario specify test].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(paths) ⇒ StaticDetector

Returns a new instance of StaticDetector.



28
29
30
# File 'lib/rspec/risky/static_detector.rb', line 28

def initialize(paths)
  @paths = Array(paths).flat_map { |path| expand_path(path) }
end

Class Method Details

.scan(paths) ⇒ Array[untyped]

Parameters:

  • paths (Array[String])

Returns:

  • (Array[untyped])


24
25
26
# File 'lib/rspec/risky/static_detector.rb', line 24

def self.scan(paths)
  new(paths).scan
end

Instance Method Details

#scanObject



32
33
34
# File 'lib/rspec/risky/static_detector.rb', line 32

def scan
  @paths.flat_map { |path| scan_file(path) }
end