Class | Brakeman::AliasProcessor |
In: |
lib/brakeman/processors/alias_processor.rb
|
Parent: | Brakeman::SexpProcessor |
Returns an s-expression with aliases replaced with their value. This does not preserve semantics (due to side effects, etc.), but it makes processing easier when searching for various things.
ARRAY_CONST | = | s(:const, :Array) |
HASH_CONST | = | s(:const, :Hash) |
RAILS_TEST | = | s(:call, s(:call, s(:const, :Rails), :env), :test?) |
result | [R] | |
tracker | [R] |
Returns a new AliasProcessor with an empty environment.
The recommended usage is:
AliasProcessor.new.process_safely src
Check if exp is a call to Array#include? on an array literal that contains all literal values. For example:
[1, 2, "a"].include? x
Returns a new SexpProcessor::Environment containing only instance variables. This is useful, for example, when processing views.
If possible, distribute operation over both sides of an or. For example,
(1 or 2) * 5
Becomes
(5 or 10)
Only works for strings and numbers right now.
This method processes the given Sexp, but copies it first so the original argument will not be modified.
set_env should be an instance of SexpProcessor::Environment. If provided, it will be used as the starting environment.
This method returns a new Sexp with variables replaced with their values, where possible.