Class: RemLint::Rules::BannerPlacement

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

Overview

BANNER written more than once, or below the reminders it appears above.

BANNER sets the line Remind prints before the day's reminders, and there is one of them. A second BANNER silently replaces the first, and one written below a REM reads as though it applied to the reminders above it when it applies to all of them equally.

Neither is an error. The first is a line of configuration that does nothing; the second is a line that does something other than where it sits suggests.

Constant Summary

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



18
19
20
# File 'lib/remlint/rules/banner_placement.rb', line 18

def self.default_severity
  "warning"
end

.descriptionObject



22
23
24
# File 'lib/remlint/rules/banner_placement.rb', line 22

def self.description
  "A second BANNER, or a BANNER written below the first reminder."
end

Instance Method Details

#checkObject



26
27
28
29
30
31
# File 'lib/remlint/rules/banner_placement.rb', line 26

def check
  banners = document.code_commands.select { |command| command.keyword?("BANNER") }

  report_duplicates(banners)
  report_late(banners.first)
end