module Fuzz::Fzzr
Fuzzers
are objects having the following readonly attributes:
#fuzz_id : id of fuzzer (Symbol) #description: (String) #errormsg : (String)
and having the following methods:
#applies_to?(object) : checks if the test applies to the object passed (Fuzz::DirObject or Fuzz::FileObject) #run(object,apply_fix): runs the fzzr test on the object passed (Fuzz::DirObject or Fuzz::FileObject) when apply_fix == true Fuzzer is directed to attempt to fix any problems found (future)
Fuzz::Fzzr
is provided as a convenience Mixin for fuzzers
Fuzzers
can inspect the options passed to fuzz.rb by referencing Fuzz::OPTIONS
Attributes
description[R]
errormsg[R]
fuzz_id[R]
Public Instance Methods
applies_to?(object)
click to toggle source
# File lib/fuzz/fzzr.rb, line 33 def applies_to?(object) !is_excluded?(object) end
is_excluded?(object)
click to toggle source
# File lib/fuzz/fzzr.rb, line 44 def is_excluded?(object) # force excludes to be parsed _excludes # now examine ((!_is_included?(object)) || _excludes.any? { |excl| (object.fullpath =~ /#{excl}/) }) end
options()
click to toggle source
# File lib/fuzz/fzzr.rb, line 51 def options Fuzz::OPTIONS[:config][:fzzr_opts][self.fuzz_id] ||= {} end
run(object, apply_fix)
click to toggle source
# File lib/fuzz/fzzr.rb, line 40 def run(object, apply_fix) true end
setup(optparser)
click to toggle source
# File lib/fuzz/fzzr.rb, line 37 def setup(optparser) end
Private Instance Methods
_excludes()
click to toggle source
# File lib/fuzz/fzzr.rb, line 65 def _excludes unless @_excludes @_excludes = [] @_excludes.concat(Fuzz.excludes) Fuzz::OPTIONS[:config][:fzzr_paths].each do |fzzrpath| fzzr_excl_file = File.join(fzzrpath, "#{self.fuzz_id}.excludes") if File.readable?(fzzr_excl_file) lns = IO.readlines(fzzr_excl_file).collect { |l| l.strip } @_excludes.concat(lns.select {|l| !(l.empty? || l[0] == '!') }) _includes.concat(lns.select {|l| !(l.empty? || l[0] != '!') }.collect {|l| l[1,l.size].strip }) else false end end end @_excludes end
_includes()
click to toggle source
# File lib/fuzz/fzzr.rb, line 61 def _includes @_includes ||= Fuzz.includes.dup end
_is_included?(object)
click to toggle source
# File lib/fuzz/fzzr.rb, line 57 def _is_included?(object) Fuzz::DirObject === object || _includes.empty? || _includes.any? { |incl| (object.fullpath =~ /#{incl}/) } end