Skip to content

Commit 6246271

Browse files
committed
voxpupuli-rubocop: Update 2.8.0->3.1.0
1 parent 2b88c97 commit 6246271

14 files changed

Lines changed: 24 additions & 76 deletions

File tree

.rubocop.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ inherit_gem:
66

77
Metrics:
88
Enabled: false
9+
10+
Style/IfUnlessModifier:
11+
Enabled: false

.rubocop_todo.yml

Lines changed: 10 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
2-
# `rubocop --auto-gen-config`
3-
# on 2024-10-20 14:24:21 UTC using RuboCop version 1.64.1.
2+
# `rubocop --auto-gen-config --no-auto-gen-timestamp`
3+
# using RuboCop version 1.75.8.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
@@ -13,14 +13,6 @@ Layout/CommentIndentation:
1313
Exclude:
1414
- 'lib/hiera/backend/eyaml/subcommands/help.rb'
1515

16-
# Offense count: 2
17-
# This cop supports safe autocorrection (--autocorrect).
18-
# Configuration parameters: EnforcedStyle.
19-
# SupportedStyles: space, compact, no_space
20-
Layout/SpaceInsideParens:
21-
Exclude:
22-
- 'lib/hiera/backend/eyaml/logginghelper.rb'
23-
2416
# Offense count: 1
2517
Lint/DuplicateMethods:
2618
Exclude:
@@ -45,23 +37,6 @@ Lint/RescueException:
4537
Exclude:
4638
- 'lib/hiera/backend/eyaml/subcommand.rb'
4739

48-
# Offense count: 1
49-
Lint/ShadowingOuterLocalVariable:
50-
Exclude:
51-
- 'lib/hiera/backend/eyaml_backend.rb'
52-
53-
# Offense count: 7
54-
# This cop supports unsafe autocorrection (--autocorrect-all).
55-
# Configuration parameters: AutoCorrect.
56-
Lint/UselessAssignment:
57-
Exclude:
58-
- 'features/support/env.rb'
59-
- 'lib/hiera/backend/eyaml/plugins.rb'
60-
- 'lib/hiera/backend/eyaml/subcommand.rb'
61-
- 'lib/hiera/backend/eyaml/subcommands/unknown_command.rb'
62-
- 'lib/hiera/backend/eyaml/subcommands/version.rb'
63-
- 'lib/hiera/backend/eyaml/utils.rb'
64-
6540
# Offense count: 1
6641
# This cop supports unsafe autocorrection (--autocorrect-all).
6742
# Configuration parameters: AutoCorrect.
@@ -74,7 +49,7 @@ Lint/UselessMethodDefinition:
7449
# Configuration parameters: AutoCorrect, CheckForMethodsWithNoSideEffects.
7550
Lint/Void:
7651
Exclude:
77-
- 'lib/hiera/backend/eyaml/parser/token.rb'
52+
- 'features/support/env.rb'
7853

7954
# Offense count: 1
8055
Naming/AccessorMethodName:
@@ -107,8 +82,9 @@ Naming/HeredocDelimiterNaming:
10782
- 'lib/hiera/backend/eyaml/subcommands/unknown_command.rb'
10883

10984
# Offense count: 1
110-
# Configuration parameters: EnforcedStyle, AllowedPatterns.
85+
# Configuration parameters: EnforcedStyle, AllowedPatterns, ForbiddenIdentifiers, ForbiddenPatterns.
11186
# SupportedStyles: snake_case, camelCase
87+
# ForbiddenIdentifiers: __id__, __send__
11288
Naming/MethodName:
11389
Exclude:
11490
- 'lib/hiera/backend/eyaml/encryptors/pkcs7.rb'
@@ -123,7 +99,7 @@ Naming/MethodParameterName:
12399
# Offense count: 1
124100
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
125101
# SupportedStyles: snake_case, normalcase, non_integer
126-
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
102+
# AllowedIdentifiers: TLS1_1, TLS1_2, capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
127103
Naming/VariableNumber:
128104
Exclude:
129105
- 'lib/hiera/backend/eyaml/utils.rb'
@@ -169,14 +145,13 @@ Security/YAMLLoad:
169145
- 'features/step_definitions/decrypt_steps.rb'
170146
- 'lib/hiera/backend/eyaml_backend.rb'
171147

172-
# Offense count: 9
148+
# Offense count: 8
173149
# This cop supports unsafe autocorrection (--autocorrect-all).
174150
# Configuration parameters: EnforcedStyle.
175151
# SupportedStyles: always, conditionals
176152
Style/AndOr:
177153
Exclude:
178154
- 'lib/hiera/backend/eyaml/encryptors/pkcs7.rb'
179-
- 'lib/hiera/backend/eyaml/highlinehelper.rb'
180155
- 'lib/hiera/backend/eyaml/logginghelper.rb'
181156
- 'lib/hiera/backend/eyaml/subcommand.rb'
182157
- 'lib/hiera/backend/eyaml_backend.rb'
@@ -220,7 +195,7 @@ Style/EnvHome:
220195

221196
# Offense count: 10
222197
# This cop supports safe autocorrection (--autocorrect).
223-
# Configuration parameters: MaxUnannotatedPlaceholdersAllowed, AllowedMethods, AllowedPatterns.
198+
# Configuration parameters: MaxUnannotatedPlaceholdersAllowed, Mode, AllowedMethods, AllowedPatterns.
224199
# SupportedStyles: annotated, template, unannotated
225200
Style/FormatStringToken:
226201
EnforcedStyle: unannotated
@@ -248,22 +223,6 @@ Style/IdenticalConditionalBranches:
248223
- 'lib/hiera/backend/eyaml/subcommands/decrypt.rb'
249224
- 'lib/hiera/backend/eyaml/subcommands/edit.rb'
250225

251-
# Offense count: 3
252-
# This cop supports safe autocorrection (--autocorrect).
253-
Style/IfUnlessModifier:
254-
Exclude:
255-
- 'lib/hiera/backend/eyaml/encryptors/pkcs7.rb'
256-
- 'lib/hiera/backend/eyaml/parser/encrypted_tokens.rb'
257-
258-
# Offense count: 2
259-
# This cop supports unsafe autocorrection (--autocorrect-all).
260-
# Configuration parameters: AllowedMethods.
261-
# AllowedMethods: nonzero?
262-
Style/IfWithBooleanLiteralBranches:
263-
Exclude:
264-
- 'lib/hiera/backend/eyaml/highlinehelper.rb'
265-
- 'lib/hiera/backend/eyaml_backend.rb'
266-
267226
# Offense count: 1
268227
# This cop supports unsafe autocorrection (--autocorrect-all).
269228
Style/MapIntoArray:
@@ -408,9 +367,9 @@ Style/ZeroLengthPredicate:
408367
Exclude:
409368
- 'lib/hiera/backend/eyaml/parser/parser.rb'
410369

411-
# Offense count: 11
370+
# Offense count: 13
412371
# This cop supports safe autocorrection (--autocorrect).
413-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
372+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
414373
# URISchemes: http, https
415374
Layout/LineLength:
416375
Max: 194

features/support/env.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
Dir.glob('features/sandbox/**/*', File::FNM_DOTMATCH).each do |file_name|
1616
next unless File.file? file_name
1717

18-
read_mode = 'r'
19-
read_mode = 'rb' if /\.bin$/.match?(file_name)
18+
'rb' if /\.bin$/.match?(file_name)
2019
file = File.open(file_name, 'r')
2120
file_contents = file.read
2221
file.close

hiera-eyaml.gemspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ Gem::Specification.new do |gem|
1616
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
1717
gem.require_paths = ['lib']
1818

19-
gem.add_runtime_dependency 'highline', '>= 2.1', '< 4'
20-
gem.add_runtime_dependency 'optimist', '~> 3.1'
19+
gem.add_dependency 'highline', '>= 2.1', '< 4'
20+
gem.add_dependency 'optimist', '~> 3.1'
2121

2222
gem.add_development_dependency 'rake', '~> 13.2', '>= 13.2.1'
2323
gem.add_development_dependency 'rspec-expectations', '~> 3.13'
24-
gem.add_development_dependency 'voxpupuli-rubocop', '~> 2.8.0'
24+
gem.add_development_dependency 'voxpupuli-rubocop', '~> 3.1.0'
2525

2626
gem.required_ruby_version = '>= 2.7', ' < 4'
2727
end

lib/hiera/backend/eyaml/highlinehelper.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@ def self.read_password
1010

1111
def self.confirm?(message)
1212
result = ask("#{message} (y/N): ")
13-
if result.downcase == 'y' or result.downcase == 'yes'
14-
true
15-
else
16-
false
17-
end
13+
%w[y yes].include?(result.downcase) || false
1814
end
1915
end
2016
end

lib/hiera/backend/eyaml/logginghelper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def self.print_message(args)
5050
if hiera?
5151
Hiera.send(hiera_loglevel, message) if threshold.nil? or Eyaml.verbosity_level > threshold
5252
elsif threshold.nil? or Eyaml.verbosity_level > threshold
53-
STDERR.puts self.colorize( message, cli_color )
53+
STDERR.puts self.colorize(message, cli_color)
5454
end
5555
end
5656

lib/hiera/backend/eyaml/parser/encrypted_tokens.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,7 @@ def initialize
146146

147147
def create_token(string)
148148
md = @regex.match(string)
149-
if EncToken.encrypt_unchanged == false && !md[1].nil? && (md[3] == EncToken.tokens_map[md[1]])
150-
return EncToken.plain_text_value(:string, md[3], md[2], string, md[1])
151-
end
149+
return EncToken.plain_text_value(:string, md[3], md[2], string, md[1]) if EncToken.encrypt_unchanged == false && !md[1].nil? && (md[3] == EncToken.tokens_map[md[1]])
152150

153151
EncToken.decrypted_value(:string, md[3], md[2], string, md[1])
154152
end
@@ -161,9 +159,7 @@ def initialize
161159

162160
def create_token(string)
163161
md = @regex.match(string)
164-
if EncToken.encrypt_unchanged == false && !md[2].nil? && (md[4] == EncToken.tokens_map[md[2]])
165-
return EncToken.plain_text_value(:string, md[4], md[3], string, md[2])
166-
end
162+
return EncToken.plain_text_value(:string, md[4], md[3], string, md[2]) if EncToken.encrypt_unchanged == false && !md[2].nil? && (md[4] == EncToken.tokens_map[md[2]])
167163

168164
EncToken.decrypted_value(:block, md[4], md[3], string, md[2], md[1])
169165
end

lib/hiera/backend/eyaml/parser/token.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ module Parser
55
class TokenType
66
attr_reader :regex
77

8-
@regex
98
def create_token(_string)
109
raise 'Abstract method called'
1110
end

lib/hiera/backend/eyaml/plugins.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ def self.find
3737
dependency = spec.dependencies.find { |d| d.name == 'hiera-eyaml' }
3838
next if dependency && !dependency.requirement.satisfied_by?(this_version)
3939

40-
file = nil
4140
file = if gem_version >= Gem::Version.new('1.8.0')
4241
spec.matches_for_glob('**/eyaml_init.rb').first
4342
else

lib/hiera/backend/eyaml/subcommand.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def self.attach_option(opt)
8686
def self.find(commandname = 'unknown_command')
8787
begin
8888
require "hiera/backend/eyaml/subcommands/#{commandname.downcase}"
89-
rescue Exception => e
89+
rescue Exception
9090
require 'hiera/backend/eyaml/subcommands/unknown_command'
9191
return Hiera::Backend::Eyaml::Subcommands::UnknownCommand
9292
end

0 commit comments

Comments
 (0)