Sha256: e239bbf3081f857ae4c7c6bf004a5ac5800fb2fe7b51f999ec75702e0dc7669f
Contents?: true
Size: 676 Bytes
Versions: 12
Compression:
Stored size: 676 Bytes
Contents
module Skeptic module Rules class NoGlobalVariables DESCRIPTION = 'Do not allow the use of global variables' include SexpVisitor def initialize(enabled = false) @enabled = enabled @violations = [] end def apply_to(code, tokens, sexp) visit sexp self end def violations @violations.map do |variable, line| "You have a global variable #{variable} on line #{line}" end end def name 'No global variables' end private on :@gvar do |variable, location| @violations << [variable, location.first] end end end end
Version data entries
12 entries across 12 versions & 1 rubygems