Class: Tainted::Lint

Inherits:
Object
  • Object
show all
Defined in:
lib/tainted/lint.rb

Instance Method Summary collapse

Constructor Details

#initialize(filepath, sources, sinks) ⇒ Lint

Returns a new instance of Lint.



5
6
7
8
9
10
11
12
13
14
# File 'lib/tainted/lint.rb', line 5

def initialize(filepath, sources, sinks)
  @filepath = filepath

  t = DataFlow.new(@filepath)
  t.generate
  var_dependencies = t.tainted
  State.instance.var_dependencies = var_dependencies

  @visitor = Static.new(sources, sinks)
end

Instance Method Details

#analyzeObject



16
17
18
19
# File 'lib/tainted/lint.rb', line 16

def analyze
  @visitor.visit(SyntaxTree.parse_file(@filepath))
  @visitor.offenses
end