Class: RemLint::Rules::RepeatTrigger

Inherits:
RemLint::Rule show all
Defined in:
lib/remlint/rules/repeat_trigger.rb

Overview

Repeats that do not repeat what the author meant.

A repeat is *n: the reminder triggers on its start date and every n days after. Two things go wrong with it, and neither is an error.

NO START DATE. A repeat counts days from somewhere, and without a fully specified start date there is nothing to count from.

A WEEKDAY IN THE TRIGGER. The weekday picks the start date and nothing else -- the recurrence then ignores weekdays entirely. REM Fri 15 Sep 2025 *10 starts on Friday 19 September and fires every ten days after, on days that are mostly not Fridays. Whatever the Fri was for, it was almost certainly not that.

Constant Summary collapse

WEEKDAY_TYPE =
"T_WkDay"

Constants inherited from RemLint::Rule

RemLint::Rule::REGISTRY

Instance Attribute Summary

Attributes inherited from RemLint::Rule

#config, #document, #offenses

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_severityObject



24
25
26
# File 'lib/remlint/rules/repeat_trigger.rb', line 24

def self.default_severity
  "warning"
end

.descriptionObject



28
29
30
# File 'lib/remlint/rules/repeat_trigger.rb', line 28

def self.description
  "A *n repeat with no start date, or with a weekday that does not affect it."
end

Instance Method Details

#checkObject



32
33
34
35
36
37
38
39
40
# File 'lib/remlint/rules/repeat_trigger.rb', line 32

def check
  document.code_commands.each do |command|
    repeat = repeat_token(command)

    if repeat
      check_repeat(command, repeat)
    end
  end
end