Class: Glyptodont::Checker
- Inherits:
-
Object
- Object
- Glyptodont::Checker
- Extended by:
- Forwardable
- Defined in:
- lib/glyptodont/checker.rb
Overview
Main class where all the work happens
Constant Summary collapse
- DEFAULT_THRESHOLD =
10- DEFAULT_MAX_AGE_IN_DAYS =
14- DEFAULT_KEYWORDS =
%w[ FIXME HACK TODO XXX ].freeze
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #check ⇒ Object
-
#initialize(args) ⇒ Checker
constructor
A new instance of Checker.
- #keywords ⇒ Object
- #max_age_in_days ⇒ Object
- #threshold ⇒ Object
Constructor Details
#initialize(args) ⇒ Checker
Returns a new instance of Checker.
24 25 26 27 |
# File 'lib/glyptodont/checker.rb', line 24 def initialize(args) = Options.new(args) @configuration = Configuration.new(directory) end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
42 43 44 |
# File 'lib/glyptodont/checker.rb', line 42 def configuration @configuration end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
42 43 44 |
# File 'lib/glyptodont/checker.rb', line 42 def end |
Instance Method Details
#check ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/glyptodont/checker.rb', line 29 def check todos = TodoResearcher.new(directory, ignore, keywords).research checks = [ Checkers::Counter.new(todos: todos, threshold: threshold), Checkers::Age.new(todos: todos, threshold: max_age_in_days) ].freeze checks.each { |check| puts check.check } checks.all?(&:passed?) end |
#keywords ⇒ Object
57 58 59 |
# File 'lib/glyptodont/checker.rb', line 57 def keywords .keywords || configuration.keywords || DEFAULT_KEYWORDS end |
#max_age_in_days ⇒ Object
53 54 55 |
# File 'lib/glyptodont/checker.rb', line 53 def max_age_in_days .max_age_in_days || configuration.max_age_in_days || DEFAULT_MAX_AGE_IN_DAYS end |
#threshold ⇒ Object
49 50 51 |
# File 'lib/glyptodont/checker.rb', line 49 def threshold .threshold || configuration.threshold || DEFAULT_THRESHOLD end |