Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 20 additions & 15 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
---
require:
- rubocop-performance
- rubocop-rspec
inherit_from: .rubocop_todo.yml

plugins:
- rubocop-rspec
- rubocop-rspec_rails
- rubocop-performance
- rubocop-factory_bot
- rubocop-capybara
AllCops:
NewCops: enable
DisplayCopNames: true
Expand Down Expand Up @@ -294,7 +299,7 @@ Performance/UriDefaultParser:
Enabled: false
RSpec/Be:
Enabled: false
RSpec/Capybara/FeatureMethods:
RSpec/Dialect:
Enabled: false
RSpec/ContainExactly:
Enabled: false
Expand All @@ -320,11 +325,11 @@ RSpec/ExpectChange:
Enabled: false
RSpec/ExpectInHook:
Enabled: false
RSpec/FactoryBot/AttributeDefinedStatically:
FactoryBot/AttributeDefinedStatically:
Enabled: false
RSpec/FactoryBot/CreateList:
FactoryBot/CreateList:
Enabled: false
RSpec/FactoryBot/FactoryClassName:
FactoryBot/FactoryClassName:
Enabled: false
RSpec/HooksBeforeExamples:
Enabled: false
Expand Down Expand Up @@ -600,27 +605,27 @@ RSpec/DuplicatedMetadata:
Enabled: false
RSpec/ExcessiveDocstringSpacing:
Enabled: false
RSpec/FactoryBot/ConsistentParenthesesStyle:
FactoryBot/ConsistentParenthesesStyle:
Enabled: false
RSpec/FactoryBot/FactoryNameStyle:
FactoryBot/FactoryNameStyle:
Enabled: false
RSpec/FactoryBot/SyntaxMethods:
FactoryBot/SyntaxMethods:
Enabled: false
RSpec/IdenticalEqualityAssertion:
Enabled: false
RSpec/NoExpectationExample:
Enabled: false
RSpec/PendingWithoutReason:
Enabled: false
RSpec/Rails/AvoidSetupHook:
RSpecRails/AvoidSetupHook:
Enabled: false
RSpec/Rails/HaveHttpStatus:
RSpecRails/HaveHttpStatus:
Enabled: false
RSpec/Rails/InferredSpecType:
RSpecRails/InferredSpecType:
Enabled: false
RSpec/Rails/MinitestAssertions:
RSpecRails/MinitestAssertions:
Enabled: false
RSpec/Rails/TravelAround:
RSpecRails/TravelAround:
Enabled: false
RSpec/RedundantAround:
Enabled: false
Expand Down
170 changes: 6 additions & 164 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,180 +1,22 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2024-06-07 10:17:46 UTC using RuboCop version 1.50.2.
# on 2025-09-30 14:23:25 UTC using RuboCop version 1.73.2.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 2
# Configuration parameters: AllowedMethods.
# AllowedMethods: enums
Lint/ConstantDefinitionInBlock:
# Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata.
# Include: **/*_spec.rb
RSpec/SpecFilePathFormat:
Exclude:
- 'lib/puppet/provider/base_dsc_lite/powershell.rb'
- 'spec/acceptance/unicode/puppet_apply_utf8_file_name_spec.rb'

# Offense count: 2
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches.
Lint/DuplicateBranch:
Exclude:
- 'spec/spec_helper_acceptance_local.rb'

# Offense count: 1
# Configuration parameters: AllowComments.
Lint/EmptyFile:
Exclude:
- 'spec/spec_helper_local.rb'

# Offense count: 4
# Configuration parameters: MaximumRangeSize.
Lint/MissingCopEnableDirective:
Exclude:
- 'lib/puppet_x/puppetlabs/dsc_lite/dsc_type_helpers.rb'
- 'lib/puppet_x/puppetlabs/dsc_lite/powershell_hash_formatter.rb'
- '**/spec/routing/**/*'
- 'spec/unit/puppet_x/dsc_lite/dsc_type_helpers_spec.rb'
- 'spec/unit/puppet_x/dsc_lite/powershell_hash_formatter_spec.rb'

# Offense count: 6
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 78

# Offense count: 2
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
# AllowedMethods: refine
Metrics/BlockLength:
Max: 134

# Offense count: 1
# Configuration parameters: CountComments, CountAsOne.
Metrics/ClassLength:
Max: 111

# Offense count: 4
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/CyclomaticComplexity:
Max: 31

# Offense count: 10
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Max: 40

# Offense count: 4
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/PerceivedComplexity:
Max: 28

# Offense count: 1
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
Naming/MethodParameterName:
Exclude:
- 'lib/puppet_x/puppetlabs/dsc_lite/dsc_type_helpers.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Performance/RedundantEqualityComparisonBlock:
Style/BitwisePredicate:
Exclude:
- 'lib/puppet_x/puppetlabs/dsc_lite/dsc_type_helpers.rb'

# Offense count: 12
# Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without
RSpec/ContextWording:
Exclude:
- 'spec/acceptance/basic_functionality/puppet_apply_dsc_manifest_spec.rb'
- 'spec/acceptance/dsc_type/custom_resource_from_system_psmodulepath_spec.rb'
- 'spec/acceptance/dsc_type/custom_resource_path_spec.rb'
- 'spec/acceptance/dsc_type/multiple_dsc_resources_in_psmodulepath_spec.rb'
- 'spec/acceptance/dsc_type/psdesiredstateconfiguration_spec.rb'
- 'spec/acceptance/reboot/negative/reboot_graph_cycle_spec.rb'
- 'spec/acceptance/reboot/reboot_no_invoke_warning_spec.rb'
- 'spec/acceptance/unicode/puppet_apply_utf8_file_name_spec.rb'

# Offense count: 11
# Configuration parameters: IgnoredMetadata.
RSpec/DescribeClass:
Exclude:
- '**/spec/features/**/*'
- '**/spec/requests/**/*'
- '**/spec/routing/**/*'
- '**/spec/system/**/*'
- '**/spec/views/**/*'
- 'spec/acceptance/basic_dsc_resources/failing_dsc_resources_spec.rb'
- 'spec/acceptance/basic_functionality/puppet_apply_dsc_manifest_spec.rb'
- 'spec/acceptance/dsc_type/custom_resource_from_system_psmodulepath_spec.rb'
- 'spec/acceptance/dsc_type/custom_resource_path_spec.rb'
- 'spec/acceptance/dsc_type/multiple_dsc_resources_in_psmodulepath_spec.rb'
- 'spec/acceptance/reboot/negative/reboot_graph_cycle_spec.rb'
- 'spec/acceptance/reboot/reboot_autonotify_explicit_spec.rb'
- 'spec/acceptance/reboot/reboot_no_invoke_warning_spec.rb'
- 'spec/acceptance/unicode/puppet_apply_utf8_file_name_spec.rb'
- 'spec/unit/puppet/type/base_dsc_spec.rb'
- 'spec/unit/puppet/type/dsc_spec.rb'

# Offense count: 14
# Configuration parameters: CountAsOne.
RSpec/ExampleLength:
Max: 73

# Offense count: 1
RSpec/LeakyConstantDeclaration:
Exclude:
- 'spec/acceptance/unicode/puppet_apply_utf8_file_name_spec.rb'

# Offense count: 17
RSpec/MultipleExpectations:
Max: 5

# Offense count: 1
# Configuration parameters: AllowedPatterns.
# AllowedPatterns: ^expect_, ^assert_
RSpec/NoExpectationExample:
Exclude:
- 'spec/unit/puppet/type/base_dsc_spec.rb'

# Offense count: 3
RSpec/PendingWithoutReason:
Exclude:
- 'spec/acceptance/reboot/negative/reboot_graph_cycle_spec.rb'
- 'spec/acceptance/reboot/reboot_autonotify_explicit_spec.rb'
- 'spec/acceptance/reboot/reboot_no_invoke_warning_spec.rb'

# Offense count: 1
RSpec/SkipBlockInsideExample:
Exclude:
- 'spec/acceptance/reboot/reboot_no_invoke_warning_spec.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: MinBranchesCount.
Style/CaseLikeIf:
Exclude:
- 'spec/spec_helper_acceptance_local.rb'

# Offense count: 2
Style/MixinUsage:
Exclude:
- 'spec/spec_helper.rb'
- 'spec/spec_helper_acceptance.rb'

# Offense count: 13
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: Mode.
Style/StringConcatenation:
Exclude:
- 'lib/puppet/provider/base_dsc_lite/powershell.rb'
- 'lib/puppet/type/dsc.rb'
- 'lib/puppet_x/puppetlabs/dsc_lite/dsc_type_helpers.rb'
- 'lib/puppet_x/puppetlabs/dsc_lite/powershell_hash_formatter.rb'
- 'spec/acceptance/basic_functionality/puppet_apply_dsc_manifest_spec.rb'

# Offense count: 3
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments.
# AllowedMethods: define_method
Style/SymbolProc:
Exclude:
- 'lib/puppet_x/puppetlabs/dsc_lite/dsc_type_helpers.rb'
9 changes: 6 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ group :development do
gem "pry", '~> 0.10', require: false
gem "simplecov-console", '~> 0.9', require: false
gem "puppet-debugger", '~> 1.0', require: false
gem "rubocop", '~> 1.50.0', require: false
gem "rubocop-performance", '= 1.16.0', require: false
gem "rubocop-rspec", '= 2.19.0', require: false
gem "rubocop", '~> 1.73.0', require: false
gem "rubocop-performance", '~> 1.24.0', require: false
gem "rubocop-rspec", '~> 3.5.0', require: false
gem 'rubocop-rspec_rails', '~> 2.31.0', require: false
gem 'rubocop-factory_bot', '~> 2.27.0', require: false
gem 'rubocop-capybara', '~> 2.22.0', require: false
gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "github_changelog_generator", require: false
gem "ruby-pwsh", require: false
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/type/dsc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def change_to_s(currentvalue, newvalue)
if currentvalue == :absent || currentvalue.nil?
_("invoked #{resource.parameters[:module].value}\\#{resource.parameters[:resource_name].value}")
else
super(currentvalue, newvalue)
super
end
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# NOTE: this is a master/agent test that does not run with Litmus.
# require 'spec_helper_acceptance'

Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

begin
require 'deep_merge'
default_facts.deep_merge!(YAML.safe_load(File.read(f), permitted_classes: [], permitted_symbols: [], aliases: true))
default_facts.deep_merge!(YAML.safe_load_file(f, permitted_classes: [], permitted_symbols: [], aliases: true))
rescue StandardError => e
RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}"
end
Expand Down
1 change: 0 additions & 1 deletion spec/unit/puppet_x/dsc_lite/dsc_type_helpers_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# frozen_string_literal: true

# rubocop:disable RSpec/FilePath
require 'spec_helper'
require 'puppet_x/puppetlabs/dsc_lite/dsc_type_helpers'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# frozen_string_literal: true

# rubocop:disable RSpec/FilePath
require 'spec_helper'
require 'puppet_x'
require 'puppet_x/puppetlabs/dsc_lite/powershell_hash_formatter'
Expand Down
Loading