Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rubocop: Update to voxpupuli-rubocop 2.1.0 #230

Merged
merged 1 commit into from
Dec 20, 2023
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
59 changes: 52 additions & 7 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2023-05-05 13:27:13 UTC using RuboCop version 1.50.2.
# on 2023-12-19 12:29:40 UTC using RuboCop version 1.57.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
Expand All @@ -15,6 +15,7 @@ Gemspec/DeprecatedAttributeAssignment:
- 'beaker-puppet.gemspec'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowedMethods, AllowedPatterns.
Lint/AmbiguousBlockAssociation:
Exclude:
Expand Down Expand Up @@ -79,8 +80,14 @@ Lint/ParenthesesAsGroupedExpression:
- 'spec/beaker-puppet/helpers/facter_helpers_spec.rb'
- 'spec/beaker-puppet/helpers/puppet_helpers_spec.rb'

# Offense count: 2
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Lint/RedundantCopDisableDirective:
Exclude:
- 'spec/beaker-puppet/install_utils/foss_utils_spec.rb'

# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
Lint/RedundantRequireStatement:
Exclude:
- 'spec/spec_helper.rb'
Expand Down Expand Up @@ -133,6 +140,7 @@ Lint/UnusedMethodArgument:
- 'spec/beaker-puppet/install_utils/windows_utils_spec.rb'

# Offense count: 17
# This cop supports unsafe autocorrection (--autocorrect-all).
Lint/UselessAssignment:
Exclude:
- 'acceptance/tests/clone_git_repo_on_test.rb'
Expand Down Expand Up @@ -276,12 +284,13 @@ Performance/StringReplacement:
- 'lib/beaker-puppet/install_utils/windows_utils.rb'
- 'spec/beaker-puppet/install_utils/windows_utils_spec.rb'

# Offense count: 5
# Offense count: 6
# This cop supports unsafe autocorrection (--autocorrect-all).
RSpec/BeEq:
Exclude:
- 'spec/beaker-puppet/helpers/tk_helpers_spec.rb'
- 'spec/beaker-puppet/install_utils/ezbake_utils_spec.rb'
- 'spec/beaker-puppet/install_utils/foss_utils_spec.rb'
- 'spec/beaker-puppet/install_utils/module_utils_spec.rb'

# Offense count: 2
Expand Down Expand Up @@ -336,6 +345,12 @@ RSpec/EmptyLineAfterHook:
- 'spec/beaker-puppet/helpers/tk_helpers_spec.rb'
- 'spec/beaker-puppet/install_utils/foss_utils_spec.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
RSpec/Eq:
Exclude:
- 'spec/beaker-puppet/install_utils/foss_utils_spec.rb'

# Offense count: 138
# Configuration parameters: CountAsOne.
RSpec/ExampleLength:
Expand Down Expand Up @@ -388,7 +403,7 @@ RSpec/HookArgument:
- 'spec/beaker-puppet/install_utils/windows_utils_spec.rb'

# Offense count: 2
# Configuration parameters: Max.
# Configuration parameters: Max, AllowedIdentifiers, AllowedPatterns.
RSpec/IndexedLet:
Exclude:
- 'spec/beaker-puppet/install_utils/foss_utils_spec.rb'
Expand Down Expand Up @@ -494,6 +509,16 @@ RSpec/ReceiveCounts:
- 'spec/beaker-puppet/helpers/puppet_helpers_spec.rb'
- 'spec/beaker-puppet/install_utils/foss_utils_spec.rb'

# Offense count: 66
# This cop supports unsafe autocorrection (--autocorrect-all).
RSpec/ReceiveMessages:
Exclude:
- 'spec/beaker-puppet/helpers/puppet_helpers_spec.rb'
- 'spec/beaker-puppet/install_utils/foss_utils_spec.rb'
- 'spec/beaker-puppet/install_utils/module_utils_spec.rb'
- 'spec/beaker-puppet/install_utils/windows_utils_spec.rb'
- 'spec/helpers.rb'

# Offense count: 19
# This cop supports safe autocorrection (--autocorrect).
RSpec/ReceiveNever:
Expand All @@ -519,6 +544,24 @@ RSpec/ReturnFromStub:
- 'spec/beaker-puppet/install_utils/foss_utils_spec.rb'
- 'spec/beaker-puppet/install_utils/puppet5_spec.rb'

# Offense count: 11
# Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata.
# Include: **/*_spec.rb
RSpec/SpecFilePathFormat:
Exclude:
- '**/spec/routing/**/*'
- 'spec/beaker-puppet/helpers/facter_helpers_spec.rb'
- 'spec/beaker-puppet/helpers/host_helpers_spec.rb'
- 'spec/beaker-puppet/helpers/puppet_helpers_spec.rb'
- 'spec/beaker-puppet/helpers/tk_helpers_spec.rb'
- 'spec/beaker-puppet/install_utils/ezbake_utils_spec.rb'
- 'spec/beaker-puppet/install_utils/foss_utils_spec.rb'
- 'spec/beaker-puppet/install_utils/module_utils_spec.rb'
- 'spec/beaker-puppet/install_utils/puppet5_spec.rb'
- 'spec/beaker-puppet/install_utils/puppet_utils_spec.rb'
- 'spec/beaker-puppet/install_utils/windows_utils_spec.rb'
- 'spec/beaker-puppet/wrappers_spec.rb'

# Offense count: 106
RSpec/StubbedMock:
Exclude:
Expand Down Expand Up @@ -642,11 +685,13 @@ Style/ClassAndModuleChildren:

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowedReceivers.
Style/CollectionCompact:
Exclude:
- 'lib/beaker-puppet/install_utils/foss_utils.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/CombinableLoops:
Exclude:
- 'spec/beaker-puppet/install_utils/windows_utils_spec.rb'
Expand Down Expand Up @@ -694,7 +739,7 @@ Style/IdenticalConditionalBranches:
- 'lib/beaker-puppet/helpers/tk_helpers.rb'
- 'lib/beaker-puppet/install_utils/ezbake_utils.rb'

# Offense count: 12
# Offense count: 13
# This cop supports safe autocorrection (--autocorrect).
Style/IfUnlessModifier:
Exclude:
Expand Down Expand Up @@ -736,7 +781,7 @@ Style/NonNilCheck:
Exclude:
- 'lib/beaker-puppet/install_utils/foss_utils.rb'

# Offense count: 10
# Offense count: 11
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
# SupportedStyles: predicate, comparison
Expand Down Expand Up @@ -834,7 +879,7 @@ Style/ZeroLengthPredicate:
- 'lib/beaker-puppet/helpers/puppet_helpers.rb'
- 'lib/beaker-puppet/install_utils/foss_utils.rb'

# Offense count: 121
# Offense count: 122
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
# URISchemes: http, https
Expand Down
2 changes: 1 addition & 1 deletion beaker-puppet.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |s|
s.add_development_dependency 'rake', '~> 13.0'
s.add_development_dependency 'rspec', '~> 3.0'
s.add_development_dependency 'rspec-its', '~> 1.3'
s.add_development_dependency 'voxpupuli-rubocop', '~> 2.0'
s.add_development_dependency 'voxpupuli-rubocop', '~> 2.1.0'

# Acceptance Testing Dependencies
s.add_development_dependency 'beaker-vmpooler', '~> 1.4'
Expand Down
68 changes: 34 additions & 34 deletions spec/beaker-puppet/install_utils/foss_utils_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -202,23 +202,23 @@ def logger
context 'lookup_in_env' do
it 'returns a default properly' do
env_var = subject.lookup_in_env('noway', 'nonesuch', 'returnme')
expect(env_var).to be == 'returnme'
expect(env_var).to eq 'returnme'
env_var = subject.lookup_in_env('noway', nil, 'returnme')
expect(env_var).to be == 'returnme'
expect(env_var).to eq 'returnme'
end
it 'finds correct env variable' do
allow(ENV).to receive(:[]).with(nil).and_return(nil)
allow(ENV).to receive(:[]).with('REALLYNONE').and_return(nil)
allow(ENV).to receive(:[]).with('NONESUCH').and_return('present')
allow(ENV).to receive(:[]).with('NOWAY_PROJ_NONESUCH').and_return('exists')
env_var = subject.lookup_in_env('nonesuch', 'noway-proj', 'fail')
expect(env_var).to be == 'exists'
expect(env_var).to eq 'exists'
env_var = subject.lookup_in_env('nonesuch')
expect(env_var).to be == 'present'
expect(env_var).to eq 'present'
env_var = subject.lookup_in_env('reallynone')
expect(env_var).to be == nil # rubocop:disable Style/NilComparison
expect(env_var).to eq nil # rubocop:disable Style/NilComparison
env_var = subject.lookup_in_env('reallynone', nil, 'default')
expect(env_var).to be == 'default'
expect(env_var).to eq 'default'
end
end

Expand All @@ -229,21 +229,21 @@ def logger
allow(ENV).to receive(:[]).with('PUPPET_FORK').and_return(nil)
allow(ENV).to receive(:[]).with('PUPPET_SERVER').and_return(nil)
url = subject.build_giturl('puppet')
expect(url).to be == 'https://github.com/puppetlabs/puppet.git'
expect(url).to eq 'https://github.com/puppetlabs/puppet.git'
url = subject.build_giturl('puppet', 'er0ck')
expect(url).to be == 'https://github.com/er0ck/puppet.git'
expect(url).to eq 'https://github.com/er0ck/puppet.git'
url = subject.build_giturl('puppet', 'er0ck', 'bitbucket.com')
expect(url).to be == 'https://bitbucket.com/er0ck-puppet.git'
expect(url).to eq 'https://bitbucket.com/er0ck-puppet.git'
url = subject.build_giturl('puppet', 'er0ck', 'github.com', 'https://')
expect(url).to be == 'https://github.com/er0ck/puppet.git'
expect(url).to eq 'https://github.com/er0ck/puppet.git'
url = subject.build_giturl('puppet', 'er0ck', 'github.com', 'https')
expect(url).to be == 'https://github.com/er0ck/puppet.git'
expect(url).to eq 'https://github.com/er0ck/puppet.git'
url = subject.build_giturl('puppet', 'er0ck', 'github.com', 'git@')
expect(url).to be == '[email protected]:er0ck/puppet.git'
expect(url).to eq '[email protected]:er0ck/puppet.git'
url = subject.build_giturl('puppet', 'er0ck', 'github.com', 'git')
expect(url).to be == '[email protected]:er0ck/puppet.git'
expect(url).to eq '[email protected]:er0ck/puppet.git'
url = subject.build_giturl('puppet', 'er0ck', 'github.com', 'ssh')
expect(url).to be == '[email protected]:er0ck/puppet.git'
expect(url).to eq '[email protected]:er0ck/puppet.git'
end

it 'uses ENV to build urls properly' do
Expand All @@ -252,21 +252,21 @@ def logger
allow(ENV).to receive(:[]).with('PUPPET_FORK').and_return('er0ck/repo')
allow(ENV).to receive(:[]).with('PUPPET_SERVER').and_return('gitlab.com')
url = subject.build_giturl('puppet')
expect(url).to be == 'https://gitlab.com/er0ck/repo-puppet.git'
expect(url).to eq 'https://gitlab.com/er0ck/repo-puppet.git'
url = subject.build_giturl('puppet', 'er0ck')
expect(url).to be == 'https://gitlab.com/er0ck-puppet.git'
expect(url).to eq 'https://gitlab.com/er0ck-puppet.git'
url = subject.build_giturl('puppet', 'er0ck', 'bitbucket.com')
expect(url).to be == 'https://bitbucket.com/er0ck-puppet.git'
expect(url).to eq 'https://bitbucket.com/er0ck-puppet.git'
url = subject.build_giturl('puppet', 'er0ck', 'github.com', 'https://')
expect(url).to be == 'https://github.com/er0ck/puppet.git'
expect(url).to eq 'https://github.com/er0ck/puppet.git'
url = subject.build_giturl('puppet', 'er0ck', 'github.com', 'https')
expect(url).to be == 'https://github.com/er0ck/puppet.git'
expect(url).to eq 'https://github.com/er0ck/puppet.git'
url = subject.build_giturl('puppet', 'er0ck', 'github.com', 'git@')
expect(url).to be == '[email protected]:er0ck/puppet.git'
expect(url).to eq '[email protected]:er0ck/puppet.git'
url = subject.build_giturl('puppet', 'er0ck', 'github.com', 'git')
expect(url).to be == '[email protected]:er0ck/puppet.git'
expect(url).to eq '[email protected]:er0ck/puppet.git'
url = subject.build_giturl('puppet', 'er0ck', 'github.com', 'ssh')
expect(url).to be == '[email protected]:er0ck/puppet.git'
expect(url).to eq '[email protected]:er0ck/puppet.git'
end
end

Expand All @@ -278,9 +278,9 @@ def logger
it "handles #{type[:protocol]} uris" do
uri = "#{type[:path]}#master"
repo_info = subject.extract_repo_info_from uri
expect(repo_info[:name]).to be == 'project'
expect(repo_info[:path]).to be == type[:path]
expect(repo_info[:rev]).to be == 'master'
expect(repo_info[:name]).to eq 'project'
expect(repo_info[:path]).to eq type[:path]
expect(repo_info[:rev]).to eq 'master'
end
end
end
Expand All @@ -291,9 +291,9 @@ def logger
{ name: 'puppet_plugin' }, { name: 'puppet' }, { name: 'facter' },
]
ordered_repos = subject.order_packages named_repos
expect(ordered_repos[0][:name]).to be == 'facter'
expect(ordered_repos[1][:name]).to be == 'puppet'
expect(ordered_repos[2][:name]).to be == 'puppet_plugin'
expect(ordered_repos[0][:name]).to eq 'facter'
expect(ordered_repos[1][:name]).to eq 'puppet'
expect(ordered_repos[2][:name]).to eq 'puppet_plugin'
end
end

Expand All @@ -313,7 +313,7 @@ def logger
subject.instance_variable_set(:@metadata, {})
version = subject.find_git_repo_versions(host, path, repository)

expect(version).to be == { 'name' => '2' }
expect(version).to be == { 'name' => '2' } # rubocop:ignore RSpec/Eq
end
end

Expand Down Expand Up @@ -1005,7 +1005,7 @@ def stub_uninteresting_portions_of_install_puppetlabs_dev_repo!
expect(subject).to receive(:install_a_puppet_msi_on).with(host, opts)

subject.install_puppet_agent_from_msi_on(host, opts)
expect(host['dist']).to be == 'puppet-agent-VERSION-x86'
expect(host['dist']).to eq 'puppet-agent-VERSION-x86'
end

it 'uses x86 msi when host is_x86_64 and install_32 is set on the options' do
Expand All @@ -1015,7 +1015,7 @@ def stub_uninteresting_portions_of_install_puppetlabs_dev_repo!
expect(subject).to receive(:install_a_puppet_msi_on).with(host, opts)

subject.install_puppet_agent_from_msi_on(host, opts)
expect(host['dist']).to be == 'puppet-agent-VERSION-x86'
expect(host['dist']).to eq 'puppet-agent-VERSION-x86'
end

it 'uses x86 msi when host is_x86_64 and ruby_arch is x86 on the host' do
Expand All @@ -1025,23 +1025,23 @@ def stub_uninteresting_portions_of_install_puppetlabs_dev_repo!
expect(subject).to receive(:install_a_puppet_msi_on).with(host, opts)

subject.install_puppet_agent_from_msi_on(host, opts)
expect(host['dist']).to be == 'puppet-agent-VERSION-x86'
expect(host['dist']).to eq 'puppet-agent-VERSION-x86'
end

it 'uses x86 msi when host !is_x86_64' do
expect(host).to receive(:is_x86_64?).and_return(false)
expect(subject).to receive(:install_a_puppet_msi_on).with(host, opts)

subject.install_puppet_agent_from_msi_on(host, opts)
expect(host['dist']).to be == 'puppet-agent-VERSION-x86'
expect(host['dist']).to eq 'puppet-agent-VERSION-x86'
end

it 'uses x64 msi when host is_x86_64, no install_32 and ruby_arch != x86' do
expect(host).to receive(:is_x86_64?).and_return(true)
expect(subject).to receive(:install_a_puppet_msi_on).with(host, opts)

subject.install_puppet_agent_from_msi_on(host, opts)
expect(host['dist']).to be == 'puppet-agent-VERSION-x64'
expect(host['dist']).to eq 'puppet-agent-VERSION-x64'
end
end

Expand Down