Class: RemLint::Rules::CoordinateNotString
- Inherits:
-
RemLint::Rule
- Object
- RemLint::Rule
- RemLint::Rules::CoordinateNotString
- Defined in:
- lib/remlint/rules/coordinate_not_string.rb
Overview
$Latitude or $Longitude set to something that is not a string.
Remind has no floating-point type. A coordinate therefore has to arrive
as a STRING and be parsed from it -- SET $Latitude "45.42", with the
quotes. SET $Latitude 45.42 is not a near miss with a rounding error in
it; 45.42 is not a Remind literal at all.
examples/astro gets this right the hard way, threading the values in
from the shell as strings:
remind -g "-i\$Latitude=\"$latitude\"" ...
The failure is quiet and confident. Remind falls back or truncates, and then reports sunrise and sunset times that look entirely plausible and are for somewhere else.
Constant Summary collapse
- COORDINATES =
%w[latitude longitude].freeze
- ASSIGNMENT =
SET $Latitude <value>, with the value running to end of line. /\A\$(?<name>\w+)\s+(?<value>.+)\z/m
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
29 30 31 |
# File 'lib/remlint/rules/coordinate_not_string.rb', line 29 def self.default_severity "error" end |
.description ⇒ Object
33 34 35 |
# File 'lib/remlint/rules/coordinate_not_string.rb', line 33 def self.description "$Latitude or $Longitude set to something other than a string." end |
Instance Method Details
#check ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/remlint/rules/coordinate_not_string.rb', line 37 def check document.code_commands.each do |command| if command.keyword?("SET") check_assignment(command) end end end |