Skip to content

Commit 51d4125

Browse files
Merge pull request #56 from puppetlabs/CAT-2281-Remove_puppet_7_test_infrastructure
(CAT-2281) Remove puppet 7 infrastructure
2 parents 181e573 + 04607df commit 51d4125

File tree

5 files changed

+13
-11
lines changed

5 files changed

+13
-11
lines changed

.rubocop.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ require:
33
- rubocop-performance
44
- rubocop-rspec
55
AllCops:
6+
NewCops: enable
67
DisplayCopNames: true
7-
TargetRubyVersion: '2.7'
8+
TargetRubyVersion: '3.1'
89
SuggestExtensions: false
910
Include:
1011
- "**/*.rb"

Gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ group :coverage, optional: ENV['COVERAGE']!='yes' do
2828
end
2929

3030
group :rubocop do
31-
gem 'rubocop', '~> 1.6.1', require: false
31+
gem 'rubocop', '~> 1.60.0', require: false
3232
gem 'rubocop-performance', '~> 1.9.1', require: false
3333
gem 'rubocop-rspec', '~> 2.0.1', require: false
3434
end

lib/puppet-lint/plugins/check_unsafe_interpolations.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
PuppetLint.new_check(:check_unsafe_interpolations) do
2-
COMMANDS = Array['command', 'onlyif', 'unless']
3-
INTERPOLATED_STRINGS = Array[:DQPRE, :DQMID]
4-
USELESS_CHARS = Array[: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
@@ -33,7 +33,7 @@ def check_unsafe_title(title)
3333
def check_unsafe_interpolations(command_resources)
3434
command_resources[:tokens].each do |token|
3535
# Skip iteration if token isn't a command of type :NAME
36-
next unless COMMANDS.include?(token.value) && (token.type == :NAME || token.type == :UNLESS)
36+
next unless COMMANDS.include?(token.value) && [:NAME, :UNLESS].include?(token.type)
3737
# Don't check the command if it is parameterised
3838
next if parameterised?(token)
3939

@@ -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

puppet-lint-check_unsafe_interpolations.gemspec

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
55
require 'puppet-lint/plugins/version'
66

77
Gem::Specification.new do |spec|
8-
spec.name = "puppet-lint-check_unsafe_interpolations"
8+
spec.name = 'puppet-lint-check_unsafe_interpolations'
99
spec.version = CheckUnsafeInterpolations::VERSION
1010
spec.authors = ['Puppet, Inc.']
1111
spec.files = Dir[
@@ -20,7 +20,8 @@ Gem::Specification.new do |spec|
2020
EOF
2121
spec.homepage = 'https://github.com/puppetlabs/puppet-lint-check_unsafe_interpolations'
2222
spec.license = 'Apache-2.0'
23-
spec.required_ruby_version = Gem::Requirement.new(">= 2.5".freeze)
23+
spec.required_ruby_version = Gem::Requirement.new('>= 3.1')
2424

2525
spec.add_dependency 'puppet-lint', '~> 4.0'
26+
spec.metadata['rubygems_mfa_required'] = 'true'
2627
end

0 commit comments

Comments
 (0)