Class: RemLint::Rules::ClauseNeedsFullDate
- Inherits:
-
RemLint::Rule
- Object
- RemLint::Rule
- RemLint::Rules::ClauseNeedsFullDate
- Defined in:
- lib/remlint/rules/clause_needs_full_date.rb
Overview
Clauses given a partial date where a full one is required.
FROM, UNTIL, THROUGH and COMPLETE-THROUGH all read their argument
with GetFullDate, which insists on a year, a month and a day. A partial
date is E_PARSE_ERR.
COMPLETE-THROUGH is the one that costs most. It is the starting point
of a TODO's whole trigger calculation, so a partial date does not merely
fail -- when the clause is missing or unusable the algorithm starts at
1990-01-01 and the TODO is overdue by decades on its first run.
Only reported when the argument is written out. A computed [expr] may
yield a perfectly good DATE and is not this rule's business.
OMIT is excluded entirely. OMIT ... THROUGH ... is the omit-range
syntax rather than a reminder's expiry, and it takes partial dates on
purpose: Remind's own tests/test.rem writes OMIT Jun THROUGH July 15
and OMIT Apr 2022 through July.
Constant Summary collapse
- CLAUSES =
%w[FROM UNTIL THROUGH COMPLETE-THROUGH].freeze
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/clause_needs_full_date.rb', line 29 def self.default_severity "error" end |
.description ⇒ Object
33 34 35 |
# File 'lib/remlint/rules/clause_needs_full_date.rb', line 33 def self.description "FROM, UNTIL, THROUGH or COMPLETE-THROUGH given a date that is not fully specified." end |
Instance Method Details
#check ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/remlint/rules/clause_needs_full_date.rb', line 37 def check document.code_commands.each do |command| unless command.keyword?("OMIT") check_command(command) end end end |