Class: RemLint::Rules::InvocationMismatch

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

Overview

Things a file does that its declared invocation will not deliver.

Three checks want the command line rather than the file, and a file that declares one gets all three:

# remlint:invocation remind -pp -g /path/to/file

SORT SPEC. -g takes up to four characters, each a or d. Anything else is silently ignored, so a sort somebody asked for never happens.

INFO HEADERS. Plain -p does not carry INFO to the back-end at all; -pp does. A file full of correct INFO clauses and a -p invocation is a reminder that is fine and plumbing that is not, and nothing reports the gap.

TODO IN A CALENDAR. TODO's nagging and its overdue tail exist only in Agenda Mode. In a calendar a TODO is an ordinary event, which makes the keyword a lie about what the reminder does.

A file with no declaration says nothing about how it is run, so this rule says nothing about it either.

Defined Under Namespace

Classes: Site

Constant Summary collapse

SORT_CHARACTERS =
%w[a d].freeze
MAX_SORT =
4

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



36
37
38
# File 'lib/remlint/rules/invocation_mismatch.rb', line 36

def self.default_severity
  "warning"
end

.descriptionObject



40
41
42
# File 'lib/remlint/rules/invocation_mismatch.rb', line 40

def self.description
  "A file whose declared `# remlint:invocation` does not deliver what it uses."
end

Instance Method Details

#checkObject



44
45
46
47
48
49
50
51
52
# File 'lib/remlint/rules/invocation_mismatch.rb', line 44

def check
  invocation = document.invocation

  if invocation.declared?
    check_sort(invocation)
    check_info(invocation)
    check_todo(invocation)
  end
end