puppet-lint 2.5.2 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +522 -0
  3. data/lib/puppet-lint/bin.rb +71 -6
  4. data/lib/puppet-lint/checkplugin.rb +43 -9
  5. data/lib/puppet-lint/checks.rb +16 -16
  6. data/lib/puppet-lint/configuration.rb +134 -134
  7. data/lib/puppet-lint/data.rb +28 -28
  8. data/lib/puppet-lint/lexer/string_slurper.rb +138 -140
  9. data/lib/puppet-lint/lexer/token.rb +188 -190
  10. data/lib/puppet-lint/lexer.rb +416 -417
  11. data/lib/puppet-lint/monkeypatches.rb +1 -1
  12. data/lib/puppet-lint/optparser.rb +5 -1
  13. data/lib/puppet-lint/plugins/check_classes/arrow_on_right_operand_line.rb +6 -4
  14. data/lib/puppet-lint/plugins/check_classes/autoloader_layout.rb +5 -3
  15. data/lib/puppet-lint/plugins/check_classes/class_inherits_from_params_class.rb +6 -4
  16. data/lib/puppet-lint/plugins/check_classes/code_on_top_scope.rb +5 -3
  17. data/lib/puppet-lint/plugins/check_classes/inherits_across_namespaces.rb +5 -3
  18. data/lib/puppet-lint/plugins/check_classes/names_containing_dash.rb +5 -3
  19. data/lib/puppet-lint/plugins/check_classes/names_containing_uppercase.rb +7 -5
  20. data/lib/puppet-lint/plugins/check_classes/nested_classes_or_defines.rb +5 -3
  21. data/lib/puppet-lint/plugins/check_classes/parameter_order.rb +7 -4
  22. data/lib/puppet-lint/plugins/check_classes/right_to_left_relationship.rb +5 -3
  23. data/lib/puppet-lint/plugins/check_classes/variable_scope.rb +15 -13
  24. data/lib/puppet-lint/plugins/check_comments/slash_comments.rb +9 -7
  25. data/lib/puppet-lint/plugins/check_comments/star_comments.rb +10 -8
  26. data/lib/puppet-lint/plugins/check_conditionals/case_without_default.rb +6 -4
  27. data/lib/puppet-lint/plugins/check_conditionals/selector_inside_resource.rb +5 -3
  28. data/lib/puppet-lint/plugins/check_documentation/documentation.rb +7 -3
  29. data/lib/puppet-lint/plugins/check_nodes/unquoted_node_name.rb +15 -11
  30. data/lib/puppet-lint/plugins/check_resources/duplicate_params.rb +5 -3
  31. data/lib/puppet-lint/plugins/check_resources/ensure_first_param.rb +8 -5
  32. data/lib/puppet-lint/plugins/check_resources/ensure_not_symlink_target.rb +11 -8
  33. data/lib/puppet-lint/plugins/check_resources/file_mode.rb +14 -9
  34. data/lib/puppet-lint/plugins/check_resources/unquoted_file_mode.rb +11 -6
  35. data/lib/puppet-lint/plugins/check_resources/unquoted_resource_title.rb +6 -4
  36. data/lib/puppet-lint/plugins/check_strings/double_quoted_strings.rb +12 -7
  37. data/lib/puppet-lint/plugins/check_strings/only_variable_string.rb +8 -6
  38. data/lib/puppet-lint/plugins/check_strings/puppet_url_without_modules.rb +14 -8
  39. data/lib/puppet-lint/plugins/check_strings/quoted_booleans.rb +11 -7
  40. data/lib/puppet-lint/plugins/check_strings/single_quote_string_with_variables.rb +11 -6
  41. data/lib/puppet-lint/plugins/check_strings/variables_not_enclosed.rb +12 -8
  42. data/lib/puppet-lint/plugins/check_variables/variable_contains_dash.rb +11 -7
  43. data/lib/puppet-lint/plugins/check_variables/variable_is_lowercase.rb +11 -7
  44. data/lib/puppet-lint/plugins/check_whitespace/140chars.rb +3 -8
  45. data/lib/puppet-lint/plugins/check_whitespace/2sp_soft_tabs.rb +10 -8
  46. data/lib/puppet-lint/plugins/check_whitespace/80chars.rb +3 -8
  47. data/lib/puppet-lint/plugins/check_whitespace/arrow_alignment.rb +10 -8
  48. data/lib/puppet-lint/plugins/check_whitespace/hard_tabs.rb +11 -7
  49. data/lib/puppet-lint/plugins/check_whitespace/line_length.rb +29 -0
  50. data/lib/puppet-lint/plugins/check_whitespace/trailing_whitespace.rb +13 -7
  51. data/lib/puppet-lint/plugins.rb +63 -61
  52. data/lib/puppet-lint/report/github.rb +17 -0
  53. data/lib/puppet-lint/report/sarif_template.json +63 -0
  54. data/lib/puppet-lint/tasks/puppet-lint.rb +84 -83
  55. data/lib/puppet-lint/tasks/release_test.rb +4 -1
  56. data/lib/puppet-lint/version.rb +1 -1
  57. data/lib/puppet-lint.rb +27 -12
  58. data/spec/acceptance/puppet_lint_spec.rb +46 -0
  59. data/spec/spec_helper.rb +92 -91
  60. data/spec/spec_helper_acceptance.rb +6 -0
  61. data/spec/spec_helper_acceptance_local.rb +38 -0
  62. data/spec/{puppet-lint → unit/puppet-lint}/bin_spec.rb +79 -35
  63. data/spec/{puppet-lint → unit/puppet-lint}/checks_spec.rb +36 -36
  64. data/spec/unit/puppet-lint/configuration_spec.rb +88 -0
  65. data/spec/{puppet-lint → unit/puppet-lint}/data_spec.rb +6 -3
  66. data/spec/{puppet-lint → unit/puppet-lint}/ignore_overrides_spec.rb +17 -17
  67. data/spec/{puppet-lint → unit/puppet-lint}/lexer/string_slurper_spec.rb +128 -128
  68. data/spec/{puppet-lint → unit/puppet-lint}/lexer/token_spec.rb +1 -1
  69. data/spec/{puppet-lint → unit/puppet-lint}/lexer_spec.rb +653 -671
  70. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/arrow_on_right_operand_line_spec.rb +16 -16
  71. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/autoloader_layout_spec.rb +13 -13
  72. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/class_inherits_from_params_class_spec.rb +3 -3
  73. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/code_on_top_scope_spec.rb +4 -4
  74. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/inherits_across_namespaces_spec.rb +4 -4
  75. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/name_contains_uppercase_spec.rb +10 -10
  76. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/names_containing_dash_spec.rb +7 -7
  77. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/nested_classes_or_defines_spec.rb +7 -7
  78. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/parameter_order_spec.rb +9 -9
  79. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/right_to_left_relationship_spec.rb +3 -3
  80. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_classes/variable_scope_spec.rb +25 -25
  81. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_comments/slash_comments_spec.rb +7 -7
  82. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_comments/star_comments_spec.rb +13 -13
  83. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_conditionals/case_without_default_spec.rb +10 -10
  84. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_conditionals/selector_inside_resource_spec.rb +3 -3
  85. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_documentation/documentation_spec.rb +8 -8
  86. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_nodes/unquoted_node_name_spec.rb +24 -24
  87. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_resources/duplicate_params_spec.rb +9 -9
  88. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_resources/ensure_first_param_spec.rb +19 -19
  89. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_resources/ensure_not_symlink_target_spec.rb +10 -10
  90. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_resources/file_mode_spec.rb +40 -40
  91. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_resources/unquoted_file_mode_spec.rb +20 -20
  92. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_resources/unquoted_resource_title_spec.rb +24 -24
  93. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_strings/double_quoted_strings_spec.rb +27 -27
  94. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_strings/only_variable_string_spec.rb +18 -18
  95. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_strings/puppet_url_without_modules_spec.rb +9 -9
  96. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_strings/quoted_booleans_spec.rb +22 -22
  97. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_strings/single_quote_string_with_variables_spec.rb +2 -2
  98. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_strings/variables_not_enclosed_spec.rb +21 -21
  99. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_variables/variable_contains_dash_spec.rb +6 -6
  100. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_variables/variable_is_lowercase_spec.rb +7 -7
  101. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_whitespace/140chars_spec.rb +5 -5
  102. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_whitespace/2sp_soft_tabs_spec.rb +2 -2
  103. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_whitespace/80chars_spec.rb +6 -6
  104. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_whitespace/arrow_alignment_spec.rb +127 -127
  105. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_whitespace/hard_tabs_spec.rb +7 -7
  106. data/spec/{puppet-lint → unit/puppet-lint}/plugins/check_whitespace/trailing_whitespace_spec.rb +15 -15
  107. data/spec/unit/puppet-lint/puppet-lint_spec.rb +18 -0
  108. metadata +63 -119
  109. data/CHANGELOG.md +0 -33
  110. data/HISTORY.md +0 -1130
  111. data/spec/puppet-lint/configuration_spec.rb +0 -66
  112. data/spec/puppet-lint_spec.rb +0 -16
@@ -1,210 +1,208 @@
1
- class PuppetLint
2
- class Lexer
3
- # Public: Stores a fragment of the manifest and the information about its
4
- # location in the manifest.
5
- class Token
6
- # Public: Returns the Symbol type of the Token.
7
- attr_accessor :type
8
-
9
- # Public: Returns the String value of the Token.
10
- attr_accessor :value
11
-
12
- # Public: Returns the raw value of the Token.
13
- attr_accessor :raw
14
-
15
- # Public: Returns the Integer line number of the manifest text where
16
- # the Token can be found.
17
- attr_reader :line
18
-
19
- # Public: Returns the Integer column number of the line of the manifest
20
- # text where the Token can be found.
21
- attr_reader :column
22
-
23
- # Public: Gets/sets the next token in the manifest.
24
- attr_accessor :next_token
25
-
26
- # Public: Gets/sets the previous token in the manifest.
27
- attr_accessor :prev_token
28
-
29
- # Public: Gets/sets the next code token (skips whitespace, comments,
30
- # etc) in the manifest.
31
- attr_accessor :next_code_token
32
-
33
- # Public: Gets/sets the previous code tokne (skips whitespace,
34
- # comments, etc) in the manifest.
35
- attr_accessor :prev_code_token
36
-
37
- # Public: Initialise a new Token object.
38
- #
39
- # type - An upper case Symbol describing the type of Token.
40
- # value - The String value of the Token.
41
- # line - The Integer line number where the Token can be found in the
42
- # manifest.
43
- # column - The Integer number of characters from the start of the line to
44
- # the start of the Token.
45
- #
46
- # Returns the instantiated Token.
47
- def initialize(type, value, line, column)
48
- @value = value
49
- @type = type
50
- @line = line
51
- @column = column
52
- @next_token = nil
53
- @prev_token = nil
54
- @next_code_token = nil
55
- @prev_code_token = nil
56
- end
1
+ class PuppetLint::Lexer
2
+ # Public: Stores a fragment of the manifest and the information about its
3
+ # location in the manifest.
4
+ class Token
5
+ # Public: Returns the Symbol type of the Token.
6
+ attr_accessor :type
7
+
8
+ # Public: Returns the String value of the Token.
9
+ attr_accessor :value
10
+
11
+ # Public: Returns the raw value of the Token.
12
+ attr_accessor :raw
13
+
14
+ # Public: Returns the Integer line number of the manifest text where
15
+ # the Token can be found.
16
+ attr_reader :line
17
+
18
+ # Public: Returns the Integer column number of the line of the manifest
19
+ # text where the Token can be found.
20
+ attr_reader :column
21
+
22
+ # Public: Gets/sets the next token in the manifest.
23
+ attr_accessor :next_token
24
+
25
+ # Public: Gets/sets the previous token in the manifest.
26
+ attr_accessor :prev_token
27
+
28
+ # Public: Gets/sets the next code token (skips whitespace, comments,
29
+ # etc) in the manifest.
30
+ attr_accessor :next_code_token
31
+
32
+ # Public: Gets/sets the previous code tokne (skips whitespace,
33
+ # comments, etc) in the manifest.
34
+ attr_accessor :prev_code_token
35
+
36
+ # Public: Initialise a new Token object.
37
+ #
38
+ # type - An upper case Symbol describing the type of Token.
39
+ # value - The String value of the Token.
40
+ # line - The Integer line number where the Token can be found in the
41
+ # manifest.
42
+ # column - The Integer number of characters from the start of the line to
43
+ # the start of the Token.
44
+ #
45
+ # Returns the instantiated Token.
46
+ def initialize(type, value, line, column)
47
+ @value = value
48
+ @type = type
49
+ @line = line
50
+ @column = column
51
+ @next_token = nil
52
+ @prev_token = nil
53
+ @next_code_token = nil
54
+ @prev_code_token = nil
55
+ end
57
56
 
58
- # Public: Produce a human friendly description of the Token when
59
- # inspected.
60
- #
61
- # Returns a String describing the Token.
62
- def inspect
63
- "<Token #{@type.inspect} (#{@value}) @#{@line}:#{@column}>"
64
- end
57
+ # Public: Produce a human friendly description of the Token when
58
+ # inspected.
59
+ #
60
+ # Returns a String describing the Token.
61
+ def inspect
62
+ "<Token #{@type.inspect} (#{@value}) @#{@line}:#{@column}>"
63
+ end
65
64
 
66
- # Public: Produce a Puppet DSL representation of a Token.
67
- #
68
- # Returns a Puppet DSL String.
69
- def to_manifest
70
- case @type
71
- when :STRING
72
- "\"#{@value}\""
73
- when :SSTRING
74
- "'#{@value}'"
75
- when :DQPRE
76
- "\"#{@value}#{string_suffix}"
77
- when :DQPOST
78
- "#{string_prefix}#{@value}\""
79
- when :DQMID
80
- "#{string_prefix}#{@value}#{string_suffix}"
81
- when :VARIABLE
82
- enclose_token_types = Set[:DQPRE, :DQMID, :HEREDOC_PRE, :HEREDOC_MID].freeze
83
- if !@prev_code_token.nil? && enclose_token_types.include?(@prev_code_token.type)
84
- @raw.nil? ? @value : @raw
85
- else
86
- "$#{@value}"
87
- end
88
- when :UNENC_VARIABLE
89
- "$#{@value}"
90
- when :NEWLINE
91
- "\n"
92
- when :COMMENT
93
- "##{@value}"
94
- when :REGEX
95
- "/#{@value}/"
96
- when :MLCOMMENT
97
- @raw
98
- when :HEREDOC_OPEN
99
- "@(#{@value})"
100
- when :HEREDOC
101
- @raw
102
- when :HEREDOC_PRE
103
- "#{@value}#{string_suffix}"
104
- when :HEREDOC_POST
105
- "#{string_prefix}#{@raw}"
106
- when :HEREDOC_MID
107
- "#{string_prefix}#{@value}#{string_suffix}"
65
+ # Public: Produce a Puppet DSL representation of a Token.
66
+ #
67
+ # Returns a Puppet DSL String.
68
+ def to_manifest
69
+ case @type
70
+ when :STRING
71
+ "\"#{@value}\""
72
+ when :SSTRING
73
+ "'#{@value}'"
74
+ when :DQPRE
75
+ "\"#{@value}#{string_suffix}"
76
+ when :DQPOST
77
+ "#{string_prefix}#{@value}\""
78
+ when :DQMID
79
+ "#{string_prefix}#{@value}#{string_suffix}"
80
+ when :VARIABLE
81
+ enclose_token_types = Set[:DQPRE, :DQMID, :HEREDOC_PRE, :HEREDOC_MID].freeze
82
+ if !@prev_code_token.nil? && enclose_token_types.include?(@prev_code_token.type)
83
+ @raw.nil? ? @value : @raw
108
84
  else
109
- @value
85
+ "$#{@value}"
110
86
  end
87
+ when :UNENC_VARIABLE
88
+ "$#{@value}"
89
+ when :NEWLINE
90
+ "\n"
91
+ when :COMMENT
92
+ "##{@value}"
93
+ when :REGEX
94
+ "/#{@value}/"
95
+ when :MLCOMMENT
96
+ @raw
97
+ when :HEREDOC_OPEN
98
+ "@(#{@value})"
99
+ when :HEREDOC
100
+ @raw
101
+ when :HEREDOC_PRE
102
+ "#{@value}#{string_suffix}"
103
+ when :HEREDOC_POST
104
+ "#{string_prefix}#{@raw}"
105
+ when :HEREDOC_MID
106
+ "#{string_prefix}#{@value}#{string_suffix}"
107
+ else
108
+ @value
111
109
  end
110
+ end
112
111
 
113
- def string_suffix
114
- no_enclose_tokens = Set.new([:UNENC_VARIABLE, :DQMID, :DQPOST, :HEREDOC_MID, :HEREDOC_POST])
115
- if next_token && no_enclose_tokens.include?(next_token.type)
116
- ''
117
- else
118
- '${'
119
- end
112
+ def string_suffix
113
+ no_enclose_tokens = Set.new([:UNENC_VARIABLE, :DQMID, :DQPOST, :HEREDOC_MID, :HEREDOC_POST])
114
+ if next_token && no_enclose_tokens.include?(next_token.type)
115
+ ''
116
+ else
117
+ '${'
120
118
  end
119
+ end
121
120
 
122
- def string_prefix
123
- no_enclose_tokens = Set.new([:UNENC_VARIABLE, :DQPRE, :DQMID, :HEREDOC_PRE, :HEREDOC_MID])
124
- if prev_token && no_enclose_tokens.include?(prev_token.type)
125
- ''
126
- else
127
- '}'
128
- end
121
+ def string_prefix
122
+ no_enclose_tokens = Set.new([:UNENC_VARIABLE, :DQPRE, :DQMID, :HEREDOC_PRE, :HEREDOC_MID])
123
+ if prev_token && no_enclose_tokens.include?(prev_token.type)
124
+ ''
125
+ else
126
+ '}'
129
127
  end
128
+ end
130
129
 
131
- # Public: Search from this token to find the next token of a given type.
132
- #
133
- # type - A Symbol type of the token to find, or an Array of Symbols.
134
- # opts - An optional Hash
135
- # :value - A token value to search for in addition to type
136
- # :skip_blocks - A Boolean to specify whether { } blocks should be
137
- # skipped over (defaults to true).
138
- #
139
- # Returns a PuppetLint::Lexer::Token object if a matching token could be
140
- # found, otherwise nil.
141
- def next_token_of(type, opts = {})
142
- find_token_of(:next, type, opts)
143
- end
130
+ # Public: Search from this token to find the next token of a given type.
131
+ #
132
+ # type - A Symbol type of the token to find, or an Array of Symbols.
133
+ # opts - An optional Hash
134
+ # :value - A token value to search for in addition to type
135
+ # :skip_blocks - A Boolean to specify whether { } blocks should be
136
+ # skipped over (defaults to true).
137
+ #
138
+ # Returns a PuppetLint::Lexer::Token object if a matching token could be
139
+ # found, otherwise nil.
140
+ def next_token_of(type, opts = {})
141
+ find_token_of(:next, type, opts)
142
+ end
144
143
 
145
- # Public: Search from this token to find the previous token of a given type.
146
- #
147
- # type - A Symbol type of the token to find, or an Array of Symbols.
148
- # opts - An optional Hash
149
- # :value - A token value to search for in addition to type
150
- # :skip_blocks - A Boolean to specify whether { } blocks should be
151
- # skipped over (defaults to true).
152
- #
153
- # Returns a PuppetLint::Lexer::Token object if a matching token could be
154
- # found, otherwise nil.
155
- def prev_token_of(type, opts = {})
156
- find_token_of(:prev, type, opts)
157
- end
144
+ # Public: Search from this token to find the previous token of a given type.
145
+ #
146
+ # type - A Symbol type of the token to find, or an Array of Symbols.
147
+ # opts - An optional Hash
148
+ # :value - A token value to search for in addition to type
149
+ # :skip_blocks - A Boolean to specify whether { } blocks should be
150
+ # skipped over (defaults to true).
151
+ #
152
+ # Returns a PuppetLint::Lexer::Token object if a matching token could be
153
+ # found, otherwise nil.
154
+ def prev_token_of(type, opts = {})
155
+ find_token_of(:prev, type, opts)
156
+ end
158
157
 
159
- # Internal: Search from this token to find the next token of a given type
160
- # in a given direction.
161
- #
162
- # direction - A Symbol direction to search (:next or :prev).
163
- # type - A Symbol type of the token to find, or an Array of Symbols.
164
- # opts - An optional Hash
165
- # :value - A token value to search for in addition to type
166
- # :skip_blocks - A Boolean to specify whether { } blocks should be
167
- # skipped over (defaults to true).
168
- #
169
- # Returns a PuppetLint::Lexer::Token object if a matching token could be
170
- # found, otherwise nil.
171
- def find_token_of(direction, type, opts = {})
172
- return nil unless [:next, :prev].include?(direction)
173
-
174
- opts[:skip_blocks] ||= true
175
- to_find = Array[*type]
176
-
177
- token_iter = send("#{direction}_token".to_sym)
178
- until token_iter.nil?
179
- if to_find.include?(token_iter.type)
180
- return token_iter if opts[:value].nil? || token_iter.value == opts[:value]
181
- end
158
+ # Internal: Search from this token to find the next token of a given type
159
+ # in a given direction.
160
+ #
161
+ # direction - A Symbol direction to search (:next or :prev).
162
+ # type - A Symbol type of the token to find, or an Array of Symbols.
163
+ # opts - An optional Hash
164
+ # :value - A token value to search for in addition to type
165
+ # :skip_blocks - A Boolean to specify whether { } blocks should be
166
+ # skipped over (defaults to true).
167
+ #
168
+ # Returns a PuppetLint::Lexer::Token object if a matching token could be
169
+ # found, otherwise nil.
170
+ def find_token_of(direction, type, opts = {})
171
+ return nil unless [:next, :prev].include?(direction)
172
+
173
+ opts[:skip_blocks] ||= true
174
+ to_find = Array[*type]
175
+
176
+ token_iter = send("#{direction}_token".to_sym)
177
+ until token_iter.nil?
178
+ if to_find.include?(token_iter.type)
179
+ return token_iter if opts[:value].nil? || token_iter.value == opts[:value]
180
+ end
182
181
 
183
- opening_token = direction == :next ? 'L' : 'R'
184
- closing_token = direction == :next ? 'R' : 'L'
185
-
186
- if opts[:skip_blocks]
187
- case token_iter.type
188
- when "#{opening_token}BRACE".to_sym
189
- token_iter = token_iter.send("#{direction}_token_of".to_sym, ["#{closing_token}BRACE".to_sym, opts])
190
- when "#{opening_token}BRACK".to_sym
191
- token_iter = token_iter.send("#{direction}_token_of".to_sym, ["#{closing_token}BRACK".to_sym, opts])
192
- when "#{opening_token}PAREN".to_sym
193
- token_iter = token_iter.send("#{direction}_token_of".to_sym, ["#{closing_token}PAREN".to_sym, opts])
194
- end
182
+ opening_token = direction == :next ? 'L' : 'R'
183
+ closing_token = direction == :next ? 'R' : 'L'
184
+
185
+ if opts[:skip_blocks]
186
+ case token_iter.type
187
+ when "#{opening_token}BRACE".to_sym
188
+ token_iter = token_iter.send("#{direction}_token_of".to_sym, ["#{closing_token}BRACE".to_sym, opts])
189
+ when "#{opening_token}BRACK".to_sym
190
+ token_iter = token_iter.send("#{direction}_token_of".to_sym, ["#{closing_token}BRACK".to_sym, opts])
191
+ when "#{opening_token}PAREN".to_sym
192
+ token_iter = token_iter.send("#{direction}_token_of".to_sym, ["#{closing_token}PAREN".to_sym, opts])
195
193
  end
196
-
197
- return nil if token_iter.nil?
198
- token_iter = token_iter.send("#{direction}_token".to_sym)
199
194
  end
200
- nil
201
- end
202
195
 
203
- def interpolated_variable?
204
- return false if type == :TYPE && value != 'type'
205
- return true if type == :NAME
206
- PuppetLint::Lexer::KEYWORDS.include?(type.to_s.downcase)
196
+ return nil if token_iter.nil?
197
+ token_iter = token_iter.send("#{direction}_token".to_sym)
207
198
  end
199
+ nil
200
+ end
201
+
202
+ def interpolated_variable?
203
+ return false if type == :TYPE && value != 'type'
204
+ return true if type == :NAME
205
+ PuppetLint::Lexer::KEYWORDS.include?(type.to_s.downcase)
208
206
  end
209
207
  end
210
208
  end