puppet-lint 2.5.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) 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 +28 -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 +69 -120
  109. data/CHANGELOG.md +0 -1130
  110. data/spec/puppet-lint/configuration_spec.rb +0 -66
  111. data/spec/puppet-lint_spec.rb +0 -16
@@ -41,7 +41,7 @@ class PuppetLint::CheckPlugin
41
41
  begin
42
42
  fix(problem)
43
43
  problem[:kind] = :fixed
44
- rescue PuppetLint::NoFix # rubocop:disable Lint/HandleExceptions
44
+ rescue PuppetLint::NoFix
45
45
  # noop
46
46
  end
47
47
  end
@@ -105,6 +105,38 @@ class PuppetLint::CheckPlugin
105
105
  PuppetLint::Data.node_indexes
106
106
  end
107
107
 
108
+ # Public: Provides positional information for any array definitions in the
109
+ # tokens array to the check plugins.
110
+ #
111
+ # Returns an array of hashes containing the position information.
112
+ def array_indexes
113
+ PuppetLint::Data.array_indexes
114
+ end
115
+
116
+ # Public: Provides positional information for any hash definitions in the
117
+ # tokens array to the check plugins.
118
+ #
119
+ # Returns an array of hashes containing the position information.
120
+ def hash_indexes
121
+ PuppetLint::Data.hash_indexes
122
+ end
123
+
124
+ # Public: Provides positional information for any default definitions in the
125
+ # tokens array to the check plugins.
126
+ #
127
+ # Returns an Array of Hashes containing the position information.
128
+ def defaults_indexes
129
+ PuppetLint::Data.defaults_indexes
130
+ end
131
+
132
+ # Public: Provides positional information for any function definition in the
133
+ # tokens array to the check plugins.
134
+ #
135
+ # Returns an Array of Hashes containing the position information.
136
+ def function_indexes
137
+ PuppetLint::Data.function_indexes
138
+ end
139
+
108
140
  # Public: Provides the expanded path of the file being analysed to check
109
141
  # plugins.
110
142
  #
@@ -147,10 +179,10 @@ class PuppetLint::CheckPlugin
147
179
  # Returns a Hash of default problem information.
148
180
  def default_info
149
181
  @default_info ||= {
150
- :check => self.class.const_get('NAME'),
151
- :fullpath => fullpath,
152
- :path => path,
153
- :filename => filename,
182
+ check: self.class.const_get('NAME'),
183
+ fullpath: fullpath,
184
+ path: path,
185
+ filename: filename,
154
186
  }
155
187
  end
156
188
 
@@ -158,10 +190,12 @@ class PuppetLint::CheckPlugin
158
190
  #
159
191
  # kind - The Symbol problem type (:warning or :error).
160
192
  # problem - A Hash containing the attributes of the problem
161
- # :message - The String message describing the problem.
162
- # :line - The Integer line number of the location of the problem.
163
- # :column - The Integer column number of the location of the problem.
164
- # :check - The Symbol name of the check that detected the problem.
193
+ # :message - The String message describing the problem.
194
+ # :line - The Integer line number of the location of the problem.
195
+ # :column - The Integer column number of the location of the problem.
196
+ # :check - The Symbol name of the check that detected the problem.
197
+ # :description - The description of the check that detected the problem.
198
+ # :help_uri - The help web page of the check that detected the problem.
165
199
  #
166
200
  # Returns nothing.
167
201
  def notify(kind, problem)
@@ -32,14 +32,14 @@ class PuppetLint::Checks
32
32
  end
33
33
 
34
34
  problems << {
35
- :kind => :error,
36
- :check => :syntax,
37
- :message => message,
38
- :line => e.line_no,
39
- :column => e.column,
40
- :fullpath => PuppetLint::Data.fullpath,
41
- :path => PuppetLint::Data.path,
42
- :filename => PuppetLint::Data.filename,
35
+ kind: :error,
36
+ check: :syntax,
37
+ message: message,
38
+ line: e.line_no,
39
+ column: e.column,
40
+ fullpath: PuppetLint::Data.fullpath,
41
+ path: PuppetLint::Data.path,
42
+ filename: PuppetLint::Data.filename,
43
43
  }
44
44
  PuppetLint::Data.tokens = []
45
45
  end
@@ -73,14 +73,14 @@ class PuppetLint::Checks
73
73
  @problems
74
74
  rescue PuppetLint::SyntaxError => e
75
75
  @problems << {
76
- :kind => :error,
77
- :check => :syntax,
78
- :message => 'Syntax error',
79
- :fullpath => File.expand_path(fileinfo, ENV['PWD']),
80
- :filename => File.basename(fileinfo),
81
- :path => fileinfo,
82
- :line => e.token.line,
83
- :column => e.token.column,
76
+ kind: :error,
77
+ check: :syntax,
78
+ message: 'Syntax error',
79
+ fullpath: File.expand_path(fileinfo, ENV['PWD']),
80
+ filename: File.basename(fileinfo),
81
+ path: fileinfo,
82
+ line: e.token.line,
83
+ column: e.token.column,
84
84
  }
85
85
 
86
86
  @problems
@@ -1,157 +1,157 @@
1
- class PuppetLint
2
- # Public: A singleton class to store the running configuration of
3
- # puppet-lint.
4
- class Configuration
5
- # Internal: Add helper methods for a new check to the
6
- # PuppetLint::Configuration object.
7
- #
8
- # check - The String name of the check.
9
- #
10
- # Returns nothing.
11
- #
12
- # Signature
13
- #
14
- # <check>_enabled?
15
- # disable_<check>
16
- # enable_<check>
17
- def self.add_check(check)
18
- # Public: Determine if the named check is enabled.
19
- #
20
- # Returns true if the check is enabled, otherwise return false.
21
- define_method("#{check}_enabled?") do
22
- settings["#{check}_disabled"] == true ? false : true
23
- end
24
-
25
- # Public: Disable the named check.
26
- #
27
- # Returns nothing.
28
- define_method("disable_#{check}") do
29
- settings["#{check}_disabled"] = true
30
- end
31
-
32
- # Public: Enable the named check.
33
- #
34
- # Returns nothing.
35
- define_method("enable_#{check}") do
36
- settings["#{check}_disabled"] = false
37
- end
1
+ # Public: A singleton class to store the running configuration of
2
+ # puppet-lint.
3
+ class PuppetLint::Configuration
4
+ # Internal: Add helper methods for a new check to the
5
+ # PuppetLint::Configuration object.
6
+ #
7
+ # check - The String name of the check.
8
+ #
9
+ # Returns nothing.
10
+ #
11
+ # Signature
12
+ #
13
+ # <check>_enabled?
14
+ # disable_<check>
15
+ # enable_<check>
16
+ def self.add_check(check)
17
+ # Public: Determine if the named check is enabled.
18
+ #
19
+ # Returns true if the check is enabled, otherwise return false.
20
+ define_method("#{check}_enabled?") do
21
+ settings["#{check}_disabled"] == true ? false : true
38
22
  end
39
23
 
40
- # Public: Catch situations where options are being set for the first time
41
- # and create the necessary methods to get & set the option in the future.
42
- #
43
- # args - An Array of values to set the option to.
44
- # method - The String name of the option.
45
- # block - Unused.
24
+ # Public: Disable the named check.
46
25
  #
47
26
  # Returns nothing.
48
- #
49
- # Signature
50
- #
51
- # <option>=(value)
52
- def method_missing(method, *args, &_block)
53
- super unless method.to_s =~ %r{^(\w+)=?$}
54
-
55
- option = Regexp.last_match(1)
56
- add_option(option.to_s) if settings[option].nil?
57
- settings[option] = args[0] unless args.empty?
27
+ define_method("disable_#{check}") do
28
+ settings["#{check}_disabled"] = true
58
29
  end
59
30
 
60
- def respond_to_missing?(method, *)
61
- method.to_s =~ %r{^\w+=?$} || super
62
- end
63
-
64
- # Internal: Add options to the PuppetLint::Configuration object from inside
65
- # the class.
66
- #
67
- # option - The String name of the option.
31
+ # Public: Enable the named check.
68
32
  #
69
33
  # Returns nothing.
70
- #
71
- # Signature
72
- #
73
- # <option>
74
- # <option>=(value)
75
- def add_option(option)
76
- self.class.add_option(option)
34
+ define_method("enable_#{check}") do
35
+ settings["#{check}_disabled"] = false
77
36
  end
37
+ end
78
38
 
79
- # Public: Add an option to the PuppetLint::Configuration object from
80
- # outside the class.
81
- #
82
- # option - The String name of the option.
83
- #
84
- # Returns nothing.
85
- #
86
- # Signature
87
- #
88
- # <option>
89
- # <option>=(value)
90
- def self.add_option(option)
91
- # Public: Set the value of the named option.
92
- #
93
- # value - The value to set the option to.
94
- #
95
- # Returns nothing.
96
- define_method("#{option}=") do |value|
97
- settings[option] = value
98
- end
39
+ # Public: Catch situations where options are being set for the first time
40
+ # and create the necessary methods to get & set the option in the future.
41
+ #
42
+ # args - An Array of values to set the option to.
43
+ # method - The String name of the option.
44
+ # block - Unused.
45
+ #
46
+ # Returns nothing.
47
+ #
48
+ # Signature
49
+ #
50
+ # <option>=(value)
51
+ def method_missing(method, *args, &_block)
52
+ super unless method.to_s =~ %r{^(\w+)=?$}
99
53
 
100
- # Public: Get the value of the named option.
101
- #
102
- # Returns the value of the option.
103
- define_method(option) do
104
- settings[option]
105
- end
106
- end
54
+ option = Regexp.last_match(1)
55
+ add_option(option.to_s) if settings[option].nil?
56
+ settings[option] = args[0] unless args.empty?
57
+ end
107
58
 
108
- # Internal: Register a new check.
109
- #
110
- # check - The String name of the check
111
- # klass - The Class containing the check logic.
59
+ def respond_to_missing?(method, *)
60
+ method.to_s =~ %r{^\w+=?$} || super
61
+ end
62
+
63
+ # Internal: Add options to the PuppetLint::Configuration object from inside
64
+ # the class.
65
+ #
66
+ # option - The String name of the option.
67
+ #
68
+ # Returns nothing.
69
+ #
70
+ # Signature
71
+ #
72
+ # <option>
73
+ # <option>=(value)
74
+ def add_option(option)
75
+ self.class.add_option(option)
76
+ end
77
+
78
+ # Public: Add an option to the PuppetLint::Configuration object from
79
+ # outside the class.
80
+ #
81
+ # option - The String name of the option.
82
+ #
83
+ # Returns nothing.
84
+ #
85
+ # Signature
86
+ #
87
+ # <option>
88
+ # <option>=(value)
89
+ def self.add_option(option)
90
+ # Public: Set the value of the named option.
91
+ #
92
+ # value - The value to set the option to.
112
93
  #
113
94
  # Returns nothing.
114
- def add_check(check, klass)
115
- self.class.add_check(check)
116
- check_object[check] = klass
95
+ define_method("#{option}=") do |value|
96
+ settings[option] = value
117
97
  end
118
98
 
119
- # Internal: Access the internal storage for settings.
99
+ # Public: Get the value of the named option.
120
100
  #
121
- # Returns a Hash containing all the settings.
122
- def settings
123
- @settings ||= {}
101
+ # Returns the value of the option.
102
+ define_method(option) do
103
+ settings[option]
124
104
  end
105
+ end
125
106
 
126
- # Internal: Access the internal storage for check method blocks.
127
- #
128
- # Returns a Hash containing all the check blocks.
129
- def check_object
130
- @check_object ||= {}
131
- end
107
+ # Internal: Register a new check.
108
+ #
109
+ # check - The String name of the check
110
+ # klass - The Class containing the check logic.
111
+ #
112
+ # Returns nothing.
113
+ def add_check(check, klass)
114
+ self.class.add_check(check)
115
+ check_object[check] = klass
116
+ end
132
117
 
133
- # Public: Get a list of all the defined checks.
134
- #
135
- # Returns an Array of String check names.
136
- def checks
137
- check_object.keys
138
- end
118
+ # Internal: Access the internal storage for settings.
119
+ #
120
+ # Returns a Hash containing all the settings.
121
+ def settings
122
+ @settings ||= {}
123
+ end
139
124
 
140
- # Public: Clear the PuppetLint::Configuration storage and set some sane
141
- # default values.
142
- #
143
- # Returns nothing.
144
- def defaults
145
- settings.clear
146
- self.with_filename = false
147
- self.fail_on_warnings = false
148
- self.error_level = :all
149
- self.log_format = ''
150
- self.with_context = false
151
- self.fix = false
152
- self.json = false
153
- self.show_ignored = false
154
- self.ignore_paths = ['vendor/**/*.pp']
155
- end
125
+ # Internal: Access the internal storage for check method blocks.
126
+ #
127
+ # Returns a Hash containing all the check blocks.
128
+ def check_object
129
+ @check_object ||= {}
130
+ end
131
+
132
+ # Public: Get a list of all the defined checks.
133
+ #
134
+ # Returns an Array of String check names.
135
+ def checks
136
+ check_object.keys
137
+ end
138
+
139
+ # Public: Clear the PuppetLint::Configuration storage and set some sane
140
+ # default values.
141
+ #
142
+ # Returns nothing.
143
+ def defaults
144
+ settings.clear
145
+ self.with_filename = false
146
+ self.fail_on_warnings = false
147
+ self.error_level = :all
148
+ self.log_format = ''
149
+ self.with_context = false
150
+ self.fix = false
151
+ self.json = false
152
+ self.sarif = false
153
+ self.show_ignored = false
154
+ self.ignore_paths = ['vendor/**/*.pp']
155
+ self.github_actions = ENV.key?('GITHUB_ACTION')
156
156
  end
157
157
  end
@@ -143,7 +143,7 @@ class PuppetLint::Data
143
143
  end
144
144
  title_array_tokens = tokens[(array_start_idx + 1)..(token_idx - 2)]
145
145
  result += title_array_tokens.select do |token|
146
- { :STRING => true, :NAME => true }.include?(token.type)
146
+ { STRING: true, NAME: true }.include?(token.type)
147
147
  end
148
148
  else
149
149
  next_token = tokens[token_idx].next_code_token
@@ -180,11 +180,11 @@ class PuppetLint::Data
180
180
  marker = rel_end_idx + start_idx
181
181
 
182
182
  result << {
183
- :start => start_idx + 1,
184
- :end => marker,
185
- :tokens => tokens[start_idx..marker],
186
- :type => find_resource_type_token(start_idx),
187
- :param_tokens => find_resource_param_tokens(tokens[start_idx..marker]),
183
+ start: start_idx + 1,
184
+ end: marker,
185
+ tokens: tokens[start_idx..marker],
186
+ type: find_resource_type_token(start_idx),
187
+ param_tokens: find_resource_param_tokens(tokens[start_idx..marker]),
188
188
  }
189
189
  end
190
190
  result
@@ -310,13 +310,13 @@ class PuppetLint::Data
310
310
  if brace_depth.zero? && !in_params
311
311
  if token.next_code_token.type != :LBRACE
312
312
  result << {
313
- :start => i,
314
- :end => i + j + 1,
315
- :tokens => tokens[i..(i + j + 1)],
316
- :param_tokens => param_tokens(tokens[i..(i + j + 1)]),
317
- :type => type,
318
- :name_token => token.next_code_token,
319
- :inherited_token => inherited_class,
313
+ start: i,
314
+ end: i + j + 1,
315
+ tokens: tokens[i..(i + j + 1)],
316
+ param_tokens: param_tokens(tokens[i..(i + j + 1)]),
317
+ type: type,
318
+ name_token: token.next_code_token,
319
+ inherited_token: inherited_class,
320
320
  }
321
321
  break
322
322
  end
@@ -367,9 +367,9 @@ class PuppetLint::Data
367
367
  end
368
368
 
369
369
  functions << {
370
- :start => token_idx,
371
- :end => real_idx,
372
- :tokens => tokens[token_idx..real_idx],
370
+ start: token_idx,
371
+ end: real_idx,
372
+ tokens: tokens[token_idx..real_idx],
373
373
  }
374
374
  end
375
375
  functions
@@ -403,9 +403,9 @@ class PuppetLint::Data
403
403
  token.prev_code_token.type == :CLASSREF
404
404
 
405
405
  arrays << {
406
- :start => token_idx,
407
- :end => real_idx,
408
- :tokens => tokens[token_idx..real_idx],
406
+ start: token_idx,
407
+ end: real_idx,
408
+ tokens: tokens[token_idx..real_idx],
409
409
  }
410
410
  end
411
411
  arrays
@@ -441,9 +441,9 @@ class PuppetLint::Data
441
441
  end
442
442
 
443
443
  hashes << {
444
- :start => token_idx,
445
- :end => real_idx,
446
- :tokens => tokens[token_idx..real_idx],
444
+ start: token_idx,
445
+ end: real_idx,
446
+ tokens: tokens[token_idx..real_idx],
447
447
  }
448
448
  end
449
449
  hashes
@@ -475,9 +475,9 @@ class PuppetLint::Data
475
475
  end
476
476
 
477
477
  defaults << {
478
- :start => token_idx,
479
- :end => real_idx,
480
- :tokens => tokens[token_idx..real_idx],
478
+ start: token_idx,
479
+ end: real_idx,
480
+ tokens: tokens[token_idx..real_idx],
481
481
  }
482
482
  end
483
483
  defaults
@@ -561,7 +561,7 @@ class PuppetLint::Data
561
561
 
562
562
  comment_words = token.value.strip.split(%r{\s+})
563
563
  comment_words.each_with_index do |word, i|
564
- if word =~ %r{\Alint\:(ignore|endignore)}
564
+ if %r{\Alint\:(ignore|endignore)}.match?(word)
565
565
  comment_data << word
566
566
  else
567
567
  # Once we reach the first non-controlcomment word, assume the rest
@@ -591,7 +591,7 @@ class PuppetLint::Data
591
591
  if top_override.nil?
592
592
  # TODO: refactor to provide a way to expose problems from
593
593
  # PuppetLint::Data via the normal problem reporting mechanism.
594
- puts "WARNING: lint:endignore comment with no opening lint:ignore:<check> comment found on line #{token.line}"
594
+ $stderr.puts "WARNING: lint:endignore comment with no opening lint:ignore:<check> comment found on line #{token.line}"
595
595
  else
596
596
  top_override.each do |start|
597
597
  next if start.nil?
@@ -607,7 +607,7 @@ class PuppetLint::Data
607
607
  end
608
608
 
609
609
  stack.each do |control|
610
- puts "WARNING: lint:ignore:#{control[0][2]} comment on line #{control[0][0]} with no closing lint:endignore comment"
610
+ $stderr.puts "WARNING: lint:ignore:#{control[0][2]} comment on line #{control[0][0]} with no closing lint:endignore comment"
611
611
  end
612
612
  end
613
613
  end