Skip to content

Commit 620f54d

Browse files
committed
rubocop update
1 parent 1868e60 commit 620f54d

File tree

5 files changed

+44
-7
lines changed

5 files changed

+44
-7
lines changed

.rubocop.yml

+3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
---
2+
inherit_from: .rubocop_todo.yml
3+
24
require:
35
- rubocop-performance
46
- rubocop-rspec
57
AllCops:
8+
NewCops: enable
69
DisplayCopNames: true
710
TargetRubyVersion: '3.1'
811
SuggestExtensions: false

.rubocop_todo.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# This configuration was generated by
2+
# `rubocop --auto-gen-config`
3+
# on 2025-04-09 15:15:52 UTC using RuboCop version 1.70.0.
4+
# The point is for the user to remove these configuration records
5+
# one by one as the offenses are removed from the code base.
6+
# Note that changes in the inspected code, or installation of new
7+
# versions of RuboCop, may require this file to be generated again.
8+
9+
# Offense count: 1
10+
# This cop supports unsafe autocorrection (--autocorrect-all).
11+
Lint/OrAssignmentToConstant:
12+
Exclude:
13+
- 'lib/puppet-lint/plugins/version.rb'
14+
15+
# Offense count: 1
16+
# This cop supports unsafe autocorrection (--autocorrect-all).
17+
Style/ArrayIntersect:
18+
Exclude:
19+
- 'lib/puppet-lint/plugins/check_unsafe_interpolations.rb'
20+
21+
# Offense count: 1
22+
# This cop supports unsafe autocorrection (--autocorrect-all).
23+
Style/ConcatArrayLiterals:
24+
Exclude:
25+
- 'lib/puppet-lint/plugins/check_unsafe_interpolations.rb'
26+
27+
# Offense count: 3
28+
# This cop supports unsafe autocorrection (--autocorrect-all).
29+
# Configuration parameters: EnforcedStyle.
30+
# SupportedStyles: literals, strict
31+
Style/MutableConstant:
32+
Exclude:
33+
- 'lib/puppet-lint/plugins/check_unsafe_interpolations.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.70.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

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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']
3+
INTERPOLATED_STRINGS = [:DQPRE, :DQMID]
4+
USELESS_CHARS = [:WHITESPACE, :COMMA]
55
def check
66
# Gather any exec commands' resources into an array
77
exec_resources = resource_indexes.map { |resource|
@@ -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

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(">= 3.1".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)