Class: LintFu::Checker
- Inherits:
-
Object
- Object
- LintFu::Checker
- Defined in:
- lib/lint_fu/checker.rb
Direct Known Subclasses
Plugins::Rails::BuggyEagerLoadChecker, Plugins::Rails::SqlInjectionChecker, Plugins::Rails::UnsafeFindChecker
Constant Summary collapse
- SUPPRESSION_COMMENT =
/#\s*lint\s*[-:]\s*(suppress|ignore) (.*)/i
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#scan ⇒ Object
readonly
Returns the value of attribute scan.
Instance Method Summary collapse
-
#initialize(scan, context, file = nil) ⇒ Checker
constructor
A new instance of Checker.
-
#method_missing(meth, *args) ⇒ Object
This class responds to any method beginning with “observe_” in order to provide a default callback for every kind of Sexp it might encounter.
- #observe_class_begin(sexp) ⇒ Object
- #observe_class_end(sexp) ⇒ Object
Constructor Details
#initialize(scan, context, file = nil) ⇒ Checker
Returns a new instance of Checker.
7 8 9 10 11 12 |
# File 'lib/lint_fu/checker.rb', line 7 def initialize(scan, context, file=nil) @scan = scan @context = context @file = file @suppressed = [] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args) ⇒ Object
This class responds to any method beginning with “observe_” in order to provide a default callback for every kind of Sexp it might encounter.
16 17 18 19 |
# File 'lib/lint_fu/checker.rb', line 16 def method_missing(meth, *args) return true if meth.to_s =~ /^observe_/ super(meth, *args) end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
5 6 7 |
# File 'lib/lint_fu/checker.rb', line 5 def context @context end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
5 6 7 |
# File 'lib/lint_fu/checker.rb', line 5 def file @file end |
#scan ⇒ Object (readonly)
Returns the value of attribute scan.
5 6 7 |
# File 'lib/lint_fu/checker.rb', line 5 def scan @scan end |
Instance Method Details
#observe_class_begin(sexp) ⇒ Object
21 22 23 |
# File 'lib/lint_fu/checker.rb', line 21 def observe_class_begin(sexp) enter_suppression_scope(sexp) end |
#observe_class_end(sexp) ⇒ Object
25 26 27 |
# File 'lib/lint_fu/checker.rb', line 25 def observe_class_end(sexp) leave_suppression_scope(sexp) end |