Class: RemLint::Rules::SystemVariableAssignment
- Inherits:
-
RemLint::Rule
- Object
- RemLint::Rule
- RemLint::Rules::SystemVariableAssignment
- Defined in:
- lib/remlint/rules/system_variable_assignment.rb
Overview
SET on a system variable that will not take it.
Remind's table marks each variable modifiable or not and, for the integer
ones, carries the range it will accept (src/var.c SysVarArr). Writing to a
read-only variable is E_CANT_MODIFY; writing out of range is
E_2LOW/E_2HIGH. Both are decidable from the line alone whenever the
value is a literal, which is how these variables are almost always set:
SET $CalMode 1 $CalMode reports the mode, it does not set it
SET $FormWidth 10 Remind accepts 20 to 500
A computed value (SET $FormWidth columns()) is left alone: the rule
cannot know what it evaluates to, and guessing would be worse than
silence.
Constant Summary collapse
- ASSIGNMENT =
SET $Name value-- andUNSET $Name, which is the same permission question with no value attached. /\A(?<sigil>\$)(?<name>\w+)\s*(?<value>.*)\z/m- INTEGER =
/\A[+-]?\d+\z/
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/system_variable_assignment.rb', line 29 def self.default_severity "error" end |
.description ⇒ Object
33 34 35 |
# File 'lib/remlint/rules/system_variable_assignment.rb', line 33 def self.description "SET on a read-only system variable, or with a value outside its range." end |
Instance Method Details
#check ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/remlint/rules/system_variable_assignment.rb', line 37 def check document.code_commands.each do |command| if command.keyword?("SET", "UNSET") check_assignment(command) end end end |