Class: RemLint::Rules::TimeZoneName
- Inherits:
-
RemLint::Rule
- Object
- RemLint::Rule
- RemLint::Rules::TimeZoneName
- Defined in:
- lib/remlint/rules/time_zone_name.rb
Overview
TZ given a zone name the system does not have.
Remind hands the name to the C library, which is case-sensitive: on a
system with a zone database, america/toronto is not America/Toronto.
An unrecognised name does not error -- the conversion simply produces
undefined results, which for a reminder means firing on the wrong day
some months from now.
This is the one rule that reads something outside the file: the zone
database, at TZDIR or /usr/share/zoneinfo. Where there is no database
to read, it reports nothing rather than guessing -- a linter that cannot
run on a machine without tzdata is a linter that cannot run in CI.
When a name matches a real zone except in case, the message names the zone that was probably meant. That is the whole difference between a rule that shrugs and one that can be acted on.
Constant Summary collapse
- DEFAULT_DIRECTORIES =
["/usr/share/zoneinfo", "/etc/zoneinfo"].freeze
- LOCAL =
TZ ""restores the local zone and is not a name to look up. ['""', "''"].freeze
Constants inherited from RemLint::Rule
Instance Attribute Summary
Attributes inherited from RemLint::Rule
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_severity ⇒ Object
31 32 33 |
# File 'lib/remlint/rules/time_zone_name.rb', line 31 def self.default_severity "warning" end |
.description ⇒ Object
35 36 37 |
# File 'lib/remlint/rules/time_zone_name.rb', line 35 def self.description "A TZ name the zone database does not have, or one that differs only in case." end |
Instance Method Details
#check ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/remlint/rules/time_zone_name.rb', line 39 def check zones = database unless zones.fetch(:exact).empty? check_commands(zones) end end |