Class: RemLint::Rules::TodoCompleteThrough
- Inherits:
-
RemLint::Rule
- Object
- RemLint::Rule
- RemLint::Rules::TodoCompleteThrough
- Defined in:
- lib/remlint/rules/todo_complete_through.rb
Overview
A TODO with no COMPLETE-THROUGH.
COMPLETE-THROUGH tells Remind the date up to which the task has been
done, and it is the starting point of a TODO's entire trigger
calculation. Without it the algorithm starts at Remind's epoch,
1990-01-01, so the task is decades overdue.
On its own that is harmless -- the TODO simply fires. It turns into a
defect the moment MAX-OVERDUE is added, because MAX-OVERDUE then
suppresses a task that is thirty-odd years past due, and the reminder
produces nothing at all:
REM TODO Mon MAX-OVERDUE 5 MSG x -> No reminders.
REM TODO Mon COMPLETE-THROUGH 2026-01-01 MAX-OVERDUE 5 MSG x -> fires
So this reports the pair, not the missing clause alone. The book
described the failure as a reminder that arrives screaming; it is in fact
a reminder that never arrives, which is harder to notice and was worth
checking against the binary rather than taking on trust. Remind's own
tests/ has twenty-one TODOs with no COMPLETE-THROUGH and they are all
fine, because none of them sets MAX-OVERDUE.
Constant Summary
Constants inherited from RemLint::Rule
Instance Attribute Summary
Attributes inherited from RemLint::Rule
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from RemLint::Rule
all, enabled_by_default?, find, inherited, #initialize, rule_name, #rule_name, #run
Constructor Details
This class inherits a constructor from RemLint::Rule
Class Method Details
.default_severity ⇒ Object
29 30 31 |
# File 'lib/remlint/rules/todo_complete_through.rb', line 29 def self.default_severity "warning" end |
.description ⇒ Object
33 34 35 |
# File 'lib/remlint/rules/todo_complete_through.rb', line 33 def self.description "A TODO with MAX-OVERDUE and no COMPLETE-THROUGH, which suppresses it entirely." end |
Instance Method Details
#check ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/remlint/rules/todo_complete_through.rb', line 37 def check document.code_commands.each do |command| trigger = document.trigger_for(command) if trigger.include?("TODO") && trigger.include?("MAX-OVERDUE") && !trigger.include?("COMPLETE-THROUGH") report(command, trigger) end end end |