Class: RemLint::Rules::PushVarsMissingName
- Inherits:
-
RemLint::Rule
- Object
- RemLint::Rule
- RemLint::Rules::PushVarsMissingName
- Defined in:
- lib/remlint/rules/push_vars_missing_name.rb
Overview
A variable assigned inside a PUSH-VARS block that the PUSH-VARS did
not name.
PUSH-VARS a b c saves exactly a, b and c, and POP-VARS restores
exactly those. An assignment to anything else inside the block survives
the POP -- which is the one thing the block was written to prevent.
The bare PUSH-VARS with no names saves every variable, so a block
written that way is never reported: it cannot leak.
Nothing about this is an error, and nothing reports it. The block looks like a scope, reads like a scope, and quietly is not one for the variable somebody added later.
Constant Summary collapse
- ASSIGNMENT =
/\A(?<name>[A-Za-z_]\w*)\b/
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
23 24 25 |
# File 'lib/remlint/rules/push_vars_missing_name.rb', line 23 def self.default_severity "warning" end |
.description ⇒ Object
27 28 29 |
# File 'lib/remlint/rules/push_vars_missing_name.rb', line 27 def self.description "A variable SET inside a PUSH-VARS block that the PUSH-VARS never named." end |
Instance Method Details
#check ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/remlint/rules/push_vars_missing_name.rb', line 31 def check @stack = [] document.code_commands.each do |command| dispatch(command) end end |