Skip to content

Commit 04607df

Browse files
committed
Unsafe autocorrections
1 parent d123611 commit 04607df

File tree

4 files changed

+6
-41
lines changed

4 files changed

+6
-41
lines changed

.rubocop.yml

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
---
2-
inherit_from: .rubocop_todo.yml
3-
42
require:
53
- rubocop-performance
64
- rubocop-rspec

.rubocop_todo.yml

-33
This file was deleted.

lib/puppet-lint/plugins/check_unsafe_interpolations.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
PuppetLint.new_check(:check_unsafe_interpolations) do
2-
COMMANDS = ['command', 'onlyif', 'unless']
3-
INTERPOLATED_STRINGS = [:DQPRE, :DQMID]
4-
USELESS_CHARS = [:WHITESPACE, :COMMA]
2+
COMMANDS = ['command', 'onlyif', 'unless'].freeze
3+
INTERPOLATED_STRINGS = [:DQPRE, :DQMID].freeze
4+
USELESS_CHARS = [:WHITESPACE, :COMMA].freeze
55
def check
66
# Gather any exec commands' resources into an array
77
exec_resources = resource_indexes.map { |resource|
88
resource_parameters = resource[:param_tokens].map(&:value)
9-
resource if resource[:type].value == 'exec' && !(COMMANDS & resource_parameters).empty?
9+
resource if resource[:type].value == 'exec' && !COMMANDS.intersect?(resource_parameters).nil?
1010
}.compact
1111

1212
# Iterate over title tokens and raise a warning if any are variables
@@ -106,7 +106,7 @@ def get_exec_titles
106106
result << tokens[title_start_idx..title_end_idx]
107107
# Title is in single quotes
108108
else
109-
tokens_array.concat([tokens[token_idx].next_code_token.next_code_token])
109+
tokens_array.push(tokens[token_idx].next_code_token.next_code_token)
110110

111111
result << tokens_array
112112
end

lib/puppet-lint/plugins/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# version of this gem
22
class CheckUnsafeInterpolations
3-
VERSION ||= '0.0.5'.freeze
3+
VERSION = '0.0.5'.freeze
44
end

0 commit comments

Comments
 (0)