Class: Scanny::Checks::RegexpCheck

Inherits:
Check
  • Object
show all
Defined in:
lib/scanny/checks/regexp_check.rb

Overview

Checks for possible improper regular expression usage.

Instance Method Summary collapse

Methods inherited from Check

#compiled_pattern, #issue, #strict?, #visit

Instance Method Details

#check(node) ⇒ Object



17
18
19
20
# File 'lib/scanny/checks/regexp_check.rb', line 17

def check(node)
  issue :low, "Possible improper regular expression usage.",
    :cwe => [185, 625, 791]
end

#patternObject



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/scanny/checks/regexp_check.rb', line 5

def pattern
  <<-EOT
    RegexLiteral<source ^= "^">
    |
    RegexLiteral<source $= "$">
    |
    DynamicRegex<string ^= "^">
    |
    DynamicRegex<array = [any*, StringLiteral<string $= "$">]>
  EOT
end