Class: RemLint::Rules::TkTagNamespace

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

Overview

A hand-written TAG in TkRemind's namespace.

TkRemind finds the REM command it is about to edit or delete by its tag, and it names its own tags TKTAG followed by a number. A hand-written tag in that shape collides, and TkRemind then edits or deletes the wrong reminder.

There is no error and no warning. The user clicks a reminder in the GUI, a different one changes, and nothing anywhere says why -- which makes it a data-loss bug with no diagnostic attached.

Constant Summary collapse

RESERVED =
/\ATKTAG\d+\z/i

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



20
21
22
# File 'lib/remlint/rules/tk_tag_namespace.rb', line 20

def self.default_severity
  "warning"
end

.descriptionObject



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

def self.description
  "A TAG in TkRemind's TKTAGn namespace, which makes the GUI edit the wrong reminder."
end

Instance Method Details

#checkObject



28
29
30
31
32
33
34
35
36
# File 'lib/remlint/rules/tk_tag_namespace.rb', line 28

def check
  document.code_commands.each do |command|
    document.trigger_for(command).clauses.each do |clause|
      if clause.name == "TAG"
        check_tag(command, clause)
      end
    end
  end
end