class InvalidIPAddrBindingRule
Public Class Methods
AnalyzeTokens(tokens)
click to toggle source
# File lib/rules/invalid_ip_addr_binding_rule.rb, line 12 def self.AnalyzeTokens(tokens) result = [] ftokens = get_tokens(tokens,"0.0.0.0") ftokens.each do |token| token_value = token.value.downcase token_type = token.type.to_s if ["EQUALS", "FARROW"].include? token.prev_code_token.type.to_s prev_token = token.prev_code_token left_side = prev_token.prev_code_token if token_value =~ @ip_addr_bin_regex_conf.value and ["VARIABLE", "NAME"].include? left_side.type.to_s result.append(Sin.new(SinType::InvalidIPAddrBinding, left_side.line, left_side.column, token.line, token.column+token_value.length)) end end end return result end
filter_tokens_per_value(tokens, token)
click to toggle source
# File lib/rules/invalid_ip_addr_binding_rule.rb, line 31 def self.filter_tokens_per_value(tokens, token) ftokens=tokens.find_all do |hash| (hash.type.to_s == 'SSTRING' || hash.type.to_s == 'STRING') and hash.value.downcase.include? token end return ftokens end