Class: RemLint::Rules::ClauseRequiresAt
- Inherits:
-
RemLint::Rule
- Object
- RemLint::Rule
- RemLint::Rules::ClauseRequiresAt
- Defined in:
- lib/remlint/rules/clause_requires_at.rb
Overview
Clauses that need a time, on a reminder that has none.
AT is what gives a reminder a time of day. Two other clauses are only
meaningful once it does:
DURATION a duration with no start time has nothing to be a duration
of, and the back-ends have nowhere to place it
TZ a bare date cannot be converted between zones -- there is no
instant to convert
Both fail in the worst way: the reminder parses, runs, and quietly does
something other than what the clause says. TZ without AT is the one
that bites months later, when a reminder fires on a day the author never
intended.
AT is not the only way to get a time, though, and Remind's own
include/lunar-eclipses.rem is 142 lines of the other way:
REM NOQUEUE [utctolocal('2097-04-26@10:37')] DURATION 196 MSG ...
A pasted expression that evaluates to a DATETIME supplies the date and
the time, so DURATION there is correct. Whether utctolocal(...)
returns a DATETIME is not decidable without running it -- so a trigger
containing any bracketed expression is left alone. Same principle as
FunctionArity staying quiet about functions it has not seen defined:
where the linter cannot know, it says nothing.
Constant Summary collapse
- REASONS =
{ "DURATION" => "a duration needs a start time", "TZ" => "a bare date has no instant to convert between zones", }.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
39 40 41 |
# File 'lib/remlint/rules/clause_requires_at.rb', line 39 def self.default_severity "error" end |
.description ⇒ Object
43 44 45 |
# File 'lib/remlint/rules/clause_requires_at.rb', line 43 def self.description "DURATION or TZ on a reminder with no AT clause." end |
Instance Method Details
#check ⇒ Object
47 48 49 50 51 |
# File 'lib/remlint/rules/clause_requires_at.rb', line 47 def check document.code_commands.each do |command| check_command(command) end end |