Skip to content

Commit 49fe689

Browse files
authored
Merge pull request #233 from puppetlabs/CAT-2453
(CAT-2453) Update rubocop to remove rexml dependency
2 parents 6fd80c1 + 3e71306 commit 49fe689

File tree

8 files changed

+35
-186
lines changed

8 files changed

+35
-186
lines changed

.rubocop.yml

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
---
2-
require:
3-
- rubocop-performance
4-
- rubocop-rspec
2+
inherit_from: .rubocop_todo.yml
3+
4+
plugins:
5+
- rubocop-rspec
6+
- rubocop-rspec_rails
7+
- rubocop-performance
8+
- rubocop-factory_bot
9+
- rubocop-capybara
510
AllCops:
611
NewCops: enable
712
DisplayCopNames: true
@@ -294,7 +299,7 @@ Performance/UriDefaultParser:
294299
Enabled: false
295300
RSpec/Be:
296301
Enabled: false
297-
RSpec/Capybara/FeatureMethods:
302+
RSpec/Dialect:
298303
Enabled: false
299304
RSpec/ContainExactly:
300305
Enabled: false
@@ -320,11 +325,11 @@ RSpec/ExpectChange:
320325
Enabled: false
321326
RSpec/ExpectInHook:
322327
Enabled: false
323-
RSpec/FactoryBot/AttributeDefinedStatically:
328+
FactoryBot/AttributeDefinedStatically:
324329
Enabled: false
325-
RSpec/FactoryBot/CreateList:
330+
FactoryBot/CreateList:
326331
Enabled: false
327-
RSpec/FactoryBot/FactoryClassName:
332+
FactoryBot/FactoryClassName:
328333
Enabled: false
329334
RSpec/HooksBeforeExamples:
330335
Enabled: false
@@ -600,27 +605,27 @@ RSpec/DuplicatedMetadata:
600605
Enabled: false
601606
RSpec/ExcessiveDocstringSpacing:
602607
Enabled: false
603-
RSpec/FactoryBot/ConsistentParenthesesStyle:
608+
FactoryBot/ConsistentParenthesesStyle:
604609
Enabled: false
605-
RSpec/FactoryBot/FactoryNameStyle:
610+
FactoryBot/FactoryNameStyle:
606611
Enabled: false
607-
RSpec/FactoryBot/SyntaxMethods:
612+
FactoryBot/SyntaxMethods:
608613
Enabled: false
609614
RSpec/IdenticalEqualityAssertion:
610615
Enabled: false
611616
RSpec/NoExpectationExample:
612617
Enabled: false
613618
RSpec/PendingWithoutReason:
614619
Enabled: false
615-
RSpec/Rails/AvoidSetupHook:
620+
RSpecRails/AvoidSetupHook:
616621
Enabled: false
617-
RSpec/Rails/HaveHttpStatus:
622+
RSpecRails/HaveHttpStatus:
618623
Enabled: false
619-
RSpec/Rails/InferredSpecType:
624+
RSpecRails/InferredSpecType:
620625
Enabled: false
621-
RSpec/Rails/MinitestAssertions:
626+
RSpecRails/MinitestAssertions:
622627
Enabled: false
623-
RSpec/Rails/TravelAround:
628+
RSpecRails/TravelAround:
624629
Enabled: false
625630
RSpec/RedundantAround:
626631
Enabled: false

.rubocop_todo.yml

Lines changed: 6 additions & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -1,180 +1,22 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2024-06-07 10:17:46 UTC using RuboCop version 1.50.2.
3+
# on 2025-09-30 14:23:25 UTC using RuboCop version 1.73.2.
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
77
# versions of RuboCop, may require this file to be generated again.
88

99
# Offense count: 2
10-
# Configuration parameters: AllowedMethods.
11-
# AllowedMethods: enums
12-
Lint/ConstantDefinitionInBlock:
10+
# Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata.
11+
# Include: **/*_spec.rb
12+
RSpec/SpecFilePathFormat:
1313
Exclude:
14-
- 'lib/puppet/provider/base_dsc_lite/powershell.rb'
15-
- 'spec/acceptance/unicode/puppet_apply_utf8_file_name_spec.rb'
16-
17-
# Offense count: 2
18-
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches.
19-
Lint/DuplicateBranch:
20-
Exclude:
21-
- 'spec/spec_helper_acceptance_local.rb'
22-
23-
# Offense count: 1
24-
# Configuration parameters: AllowComments.
25-
Lint/EmptyFile:
26-
Exclude:
27-
- 'spec/spec_helper_local.rb'
28-
29-
# Offense count: 4
30-
# Configuration parameters: MaximumRangeSize.
31-
Lint/MissingCopEnableDirective:
32-
Exclude:
33-
- 'lib/puppet_x/puppetlabs/dsc_lite/dsc_type_helpers.rb'
34-
- 'lib/puppet_x/puppetlabs/dsc_lite/powershell_hash_formatter.rb'
14+
- '**/spec/routing/**/*'
3515
- 'spec/unit/puppet_x/dsc_lite/dsc_type_helpers_spec.rb'
3616
- 'spec/unit/puppet_x/dsc_lite/powershell_hash_formatter_spec.rb'
3717

38-
# Offense count: 6
39-
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
40-
Metrics/AbcSize:
41-
Max: 78
42-
43-
# Offense count: 2
44-
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
45-
# AllowedMethods: refine
46-
Metrics/BlockLength:
47-
Max: 134
48-
49-
# Offense count: 1
50-
# Configuration parameters: CountComments, CountAsOne.
51-
Metrics/ClassLength:
52-
Max: 111
53-
54-
# Offense count: 4
55-
# Configuration parameters: AllowedMethods, AllowedPatterns.
56-
Metrics/CyclomaticComplexity:
57-
Max: 31
58-
59-
# Offense count: 10
60-
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
61-
Metrics/MethodLength:
62-
Max: 40
63-
64-
# Offense count: 4
65-
# Configuration parameters: AllowedMethods, AllowedPatterns.
66-
Metrics/PerceivedComplexity:
67-
Max: 28
68-
69-
# Offense count: 1
70-
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
71-
# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
72-
Naming/MethodParameterName:
73-
Exclude:
74-
- 'lib/puppet_x/puppetlabs/dsc_lite/dsc_type_helpers.rb'
75-
7618
# Offense count: 1
7719
# This cop supports unsafe autocorrection (--autocorrect-all).
78-
Performance/RedundantEqualityComparisonBlock:
20+
Style/BitwisePredicate:
7921
Exclude:
80-
- 'lib/puppet_x/puppetlabs/dsc_lite/dsc_type_helpers.rb'
81-
82-
# Offense count: 12
83-
# Configuration parameters: Prefixes, AllowedPatterns.
84-
# Prefixes: when, with, without
85-
RSpec/ContextWording:
86-
Exclude:
87-
- 'spec/acceptance/basic_functionality/puppet_apply_dsc_manifest_spec.rb'
88-
- 'spec/acceptance/dsc_type/custom_resource_from_system_psmodulepath_spec.rb'
89-
- 'spec/acceptance/dsc_type/custom_resource_path_spec.rb'
90-
- 'spec/acceptance/dsc_type/multiple_dsc_resources_in_psmodulepath_spec.rb'
91-
- 'spec/acceptance/dsc_type/psdesiredstateconfiguration_spec.rb'
92-
- 'spec/acceptance/reboot/negative/reboot_graph_cycle_spec.rb'
93-
- 'spec/acceptance/reboot/reboot_no_invoke_warning_spec.rb'
94-
- 'spec/acceptance/unicode/puppet_apply_utf8_file_name_spec.rb'
95-
96-
# Offense count: 11
97-
# Configuration parameters: IgnoredMetadata.
98-
RSpec/DescribeClass:
99-
Exclude:
100-
- '**/spec/features/**/*'
101-
- '**/spec/requests/**/*'
102-
- '**/spec/routing/**/*'
103-
- '**/spec/system/**/*'
104-
- '**/spec/views/**/*'
105-
- 'spec/acceptance/basic_dsc_resources/failing_dsc_resources_spec.rb'
106-
- 'spec/acceptance/basic_functionality/puppet_apply_dsc_manifest_spec.rb'
107-
- 'spec/acceptance/dsc_type/custom_resource_from_system_psmodulepath_spec.rb'
108-
- 'spec/acceptance/dsc_type/custom_resource_path_spec.rb'
109-
- 'spec/acceptance/dsc_type/multiple_dsc_resources_in_psmodulepath_spec.rb'
110-
- 'spec/acceptance/reboot/negative/reboot_graph_cycle_spec.rb'
111-
- 'spec/acceptance/reboot/reboot_autonotify_explicit_spec.rb'
112-
- 'spec/acceptance/reboot/reboot_no_invoke_warning_spec.rb'
113-
- 'spec/acceptance/unicode/puppet_apply_utf8_file_name_spec.rb'
114-
- 'spec/unit/puppet/type/base_dsc_spec.rb'
115-
- 'spec/unit/puppet/type/dsc_spec.rb'
116-
117-
# Offense count: 14
118-
# Configuration parameters: CountAsOne.
119-
RSpec/ExampleLength:
120-
Max: 73
121-
122-
# Offense count: 1
123-
RSpec/LeakyConstantDeclaration:
124-
Exclude:
125-
- 'spec/acceptance/unicode/puppet_apply_utf8_file_name_spec.rb'
126-
127-
# Offense count: 17
128-
RSpec/MultipleExpectations:
129-
Max: 5
130-
131-
# Offense count: 1
132-
# Configuration parameters: AllowedPatterns.
133-
# AllowedPatterns: ^expect_, ^assert_
134-
RSpec/NoExpectationExample:
135-
Exclude:
136-
- 'spec/unit/puppet/type/base_dsc_spec.rb'
137-
138-
# Offense count: 3
139-
RSpec/PendingWithoutReason:
140-
Exclude:
141-
- 'spec/acceptance/reboot/negative/reboot_graph_cycle_spec.rb'
142-
- 'spec/acceptance/reboot/reboot_autonotify_explicit_spec.rb'
143-
- 'spec/acceptance/reboot/reboot_no_invoke_warning_spec.rb'
144-
145-
# Offense count: 1
146-
RSpec/SkipBlockInsideExample:
147-
Exclude:
148-
- 'spec/acceptance/reboot/reboot_no_invoke_warning_spec.rb'
149-
150-
# Offense count: 1
151-
# This cop supports unsafe autocorrection (--autocorrect-all).
152-
# Configuration parameters: MinBranchesCount.
153-
Style/CaseLikeIf:
154-
Exclude:
155-
- 'spec/spec_helper_acceptance_local.rb'
156-
157-
# Offense count: 2
158-
Style/MixinUsage:
159-
Exclude:
160-
- 'spec/spec_helper.rb'
161-
- 'spec/spec_helper_acceptance.rb'
162-
163-
# Offense count: 13
164-
# This cop supports unsafe autocorrection (--autocorrect-all).
165-
# Configuration parameters: Mode.
166-
Style/StringConcatenation:
167-
Exclude:
168-
- 'lib/puppet/provider/base_dsc_lite/powershell.rb'
16922
- 'lib/puppet/type/dsc.rb'
170-
- 'lib/puppet_x/puppetlabs/dsc_lite/dsc_type_helpers.rb'
171-
- 'lib/puppet_x/puppetlabs/dsc_lite/powershell_hash_formatter.rb'
172-
- 'spec/acceptance/basic_functionality/puppet_apply_dsc_manifest_spec.rb'
173-
174-
# Offense count: 3
175-
# This cop supports unsafe autocorrection (--autocorrect-all).
176-
# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments.
177-
# AllowedMethods: define_method
178-
Style/SymbolProc:
179-
Exclude:
180-
- 'lib/puppet_x/puppetlabs/dsc_lite/dsc_type_helpers.rb'

Gemfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,12 @@ group :development do
2727
gem "pry", '~> 0.10', require: false
2828
gem "simplecov-console", '~> 0.9', require: false
2929
gem "puppet-debugger", '~> 1.0', require: false
30-
gem "rubocop", '~> 1.50.0', require: false
31-
gem "rubocop-performance", '= 1.16.0', require: false
32-
gem "rubocop-rspec", '= 2.19.0', require: false
30+
gem "rubocop", '~> 1.73.0', require: false
31+
gem "rubocop-performance", '~> 1.24.0', require: false
32+
gem "rubocop-rspec", '~> 3.5.0', require: false
33+
gem 'rubocop-rspec_rails', '~> 2.31.0', require: false
34+
gem 'rubocop-factory_bot', '~> 2.27.0', require: false
35+
gem 'rubocop-capybara', '~> 2.22.0', require: false
3336
gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
3437
gem "github_changelog_generator", require: false
3538
gem "ruby-pwsh", require: false

lib/puppet/type/dsc.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def change_to_s(currentvalue, newvalue)
4545
if currentvalue == :absent || currentvalue.nil?
4646
_("invoked #{resource.parameters[:module].value}\\#{resource.parameters[:resource_name].value}")
4747
else
48-
super(currentvalue, newvalue)
48+
super
4949
end
5050
end
5151
end

spec/acceptance/basic_functionality/negative/dsc_on_linux_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# frozen_string_literal: true
2+
23
# NOTE: this is a master/agent test that does not run with Litmus.
34
# require 'spec_helper_acceptance'
45

spec/spec_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
begin
2828
require 'deep_merge'
29-
default_facts.deep_merge!(YAML.safe_load(File.read(f), permitted_classes: [], permitted_symbols: [], aliases: true))
29+
default_facts.deep_merge!(YAML.safe_load_file(f, permitted_classes: [], permitted_symbols: [], aliases: true))
3030
rescue StandardError => e
3131
RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}"
3232
end

spec/unit/puppet_x/dsc_lite/dsc_type_helpers_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# frozen_string_literal: true
22

3-
# rubocop:disable RSpec/FilePath
43
require 'spec_helper'
54
require 'puppet_x/puppetlabs/dsc_lite/dsc_type_helpers'
65

spec/unit/puppet_x/dsc_lite/powershell_hash_formatter_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# frozen_string_literal: true
22

3-
# rubocop:disable RSpec/FilePath
43
require 'spec_helper'
54
require 'puppet_x'
65
require 'puppet_x/puppetlabs/dsc_lite/powershell_hash_formatter'

0 commit comments

Comments
 (0)