Class: RemLint::Rules::InfoClause

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

Overview

INFO clauses a back-end will drop.

INFO attaches a "Header: value" pair to a reminder, which the machine-readable back-ends carry through and %<Header> reads back. Two things go wrong, and a back-end's only recourse for either is to ignore the clause:

INFO with no quoted "Header: value" string
two INFO clauses on one command with the same header

Headers are not case-sensitive, so Url: and URL: on one command are the same collision -- which is exactly the sort of duplicate that reads as two distinct pieces of information.

The reminder still triggers either way. What goes missing is the location or the URL, silently, in the calendar app at the far end of the export.

Constant Summary collapse

WELL_FORMED =

"Header: value" -- the header runs to the first colon and cannot contain a quote.

/\A(?<quote>["'])(?<header>[^:"']+):(?<value>.*)\k<quote>\z/m

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



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

def self.default_severity
  "warning"
end

.descriptionObject



32
33
34
# File 'lib/remlint/rules/info_clause.rb', line 32

def self.description
  "An INFO clause that is malformed, or duplicates another's header."
end

Instance Method Details

#checkObject



36
37
38
39
40
# File 'lib/remlint/rules/info_clause.rb', line 36

def check
  document.code_commands.each do |command|
    check_command(command)
  end
end