Class: RemLint::Rules::UntilBeforeFrom
- Inherits:
-
RemLint::Rule
- Object
- RemLint::Rule
- RemLint::Rules::UntilBeforeFrom
- Defined in:
- lib/remlint/rules/until_before_from.rb
Overview
A reminder whose window closes before it opens.
FROM and SCANFROM set the date Remind starts scanning from; UNTIL
(and its synonym THROUGH) sets the date the reminder expires. An
UNTIL strictly before the start describes an empty window, and the
reminder can never fire.
Unusually for this linter, Remind is not silent here: it warns at parse time, with a different message for each start keyword --
Warning: UNTIL/THROUGH date earlier than FROM date
Warning: UNTIL/THROUGH date earlier than SCANFROM date
-- so the value on offer is smaller than usual: saying it in the editor
and in CI rather than only when someone runs the file and reads stderr.
Remind's own tests/test.rem marks both forms "Diagnosed".
Strictly before, not on or before. FROM 1992-01-06 UNTIL 1992-01-06 is
a legal one-day window and fires on the day; Remind's own warning says
"earlier than" for the same reason.
Both dates have to be fully spelled out for this to be decidable, which
is no restriction: GetFullDate requires exactly that of both keywords.
Constant Summary collapse
- EXPIRY =
UNTILandTHROUGHare the same clause --ParseUntiltakes both and writes the same field. %w[UNTIL THROUGH].freeze
- START =
FROMandSCANFROMare different clauses that both set where the scan begins, and Remind checks the expiry against either. %w[FROM SCANFROM].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
40 41 42 |
# File 'lib/remlint/rules/until_before_from.rb', line 40 def self.default_severity "error" end |
.description ⇒ Object
44 45 46 |
# File 'lib/remlint/rules/until_before_from.rb', line 44 def self.description "An UNTIL or THROUGH date earlier than the reminder's FROM or SCANFROM." end |
Instance Method Details
#check ⇒ Object
48 49 50 51 52 |
# File 'lib/remlint/rules/until_before_from.rb', line 48 def check document.code_commands.each do |command| check_window(command) end end |