Skip to content

Commit

Permalink
rubocop: autofix
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak authored and evgeni committed Sep 29, 2023
1 parent bd182c3 commit b6608c3
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 26 deletions.
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
inherit_from: .rubocop_todo.yml

inherit_gem:
voxpupuli-test: rubocop.yml

Expand Down
27 changes: 27 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2023-08-17 21:33:46 UTC using RuboCop version 1.50.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: 9
# This cop supports unsafe autocorrection (--autocorrect-all).
RSpec/BeEq:
Exclude:
- 'spec/unit/puppet/provider/jenkins_job/cli_spec.rb'
- 'spec/unit/puppet/x/jenkins/provider/cli_spec.rb'

# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: .
# SupportedStyles: constant, string
RSpec/VerifiedDoubleReference:
EnforcedStyle: string

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/SlicingWithRange:
Exclude:
- 'lib/puppet/jenkins/plugins.rb'
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/jenkins_port.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Puppet::Parser::Functions
newfunction(:jenkins_port, type: :rvalue, doc: <<-'ENDHEREDOC') do |_args|
newfunction(:jenkins_port, type: :rvalue, doc: <<-ENDHEREDOC) do |_args|
Return the configurad Jenkins port value
(corresponds to /etc/defaults/jenkins -> JENKINS_PORT
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/jenkins_prefix.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Puppet::Parser::Functions
newfunction(:jenkins_prefix, type: :rvalue, doc: <<-'ENDHEREDOC') do |_args|
newfunction(:jenkins_prefix, type: :rvalue, doc: <<-ENDHEREDOC) do |_args|
Return the configured Jenkins prefix value
(corresponds to /etc/defaults/jenkins -> PREFIX)
Expand Down
2 changes: 0 additions & 2 deletions lib/puppet/provider/jenkins_authorization_strategy/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ def self.get_authorization_strategy(catalog = nil)
end
private_class_method :get_authorization_strategy

# rubocop:disable Naming/AccessorMethodName
def set_jenkins_instance(input = nil)
input ||= to_hash

Expand All @@ -91,5 +90,4 @@ def set_strategy_unsecured
}
set_jenkins_instance(input)
end
# rubocop:enable Naming/AccessorMethodName
end
2 changes: 0 additions & 2 deletions lib/puppet/provider/jenkins_security_realm/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ def self.get_security_realm(catalog = nil)
end
private_class_method :get_security_realm

# rubocop:disable Naming/AccessorMethodName
def set_jenkins_instance(input = nil)
input ||= to_hash

Expand All @@ -92,5 +91,4 @@ def set_security_none
}
set_jenkins_instance(input)
end
# rubocop:enable Naming/AccessorMethodName
end
12 changes: 6 additions & 6 deletions spec/acceptance/job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

describe 'jenkins::job' do
let(:test_build_job) do
example = <<~'EOS'
example = <<~EOS
<?xml version='1.0' encoding='UTF-8'?>
<project>
<actions/>
Expand Down Expand Up @@ -39,7 +39,7 @@
# the historical assumption is that this will work without cli => true
# set on the jenkins class
jenkins::job { 'test-build-job':
config => \'#{test_build_job}\',
config => '#{test_build_job}',
}
EOS

Expand All @@ -65,14 +65,14 @@
pp_create = <<-EOS
include jenkins
jenkins::job {'test-noreplace-job':
config => \'#{test_build_job.gsub('<description>test job</description>', '<description>do not overwrite me</description>')}\',
config => '#{test_build_job.gsub('<description>test job</description>', '<description>do not overwrite me</description>')}',
}
EOS

pp_update = <<-EOS
include jenkins
jenkins::job {'test-noreplace-job':
config => \'#{test_build_job}\',
config => '#{test_build_job}',
replace => false,
}
EOS
Expand All @@ -97,7 +97,7 @@
pp = <<-EOS
include jenkins
jenkins::job { 'test-build-job':
config => \'#{test_build_job}\',
config => '#{test_build_job}',
}
EOS

Expand All @@ -108,7 +108,7 @@
include jenkins
jenkins::job { 'test-build-job':
ensure => 'absent',
config => \'#{test_build_job}\',
config => '#{test_build_job}',
}
EOS

Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/plugin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class {'jenkins':
end
end

describe command("unzip -p #{PDIR}/jquery3-api.hpi META-INF/MANIFEST.MF | sed 's/Plugin-Version: \\\(.*\\\)/\\1/;tx;d;:x'") do
describe command("unzip -p #{PDIR}/jquery3-api.hpi META-INF/MANIFEST.MF | sed 's/Plugin-Version: \\(.*\\)/\\1/;tx;d;:x'") do
its(:stdout) { is_expected.to eq("3.6.0-3\n") }
end

Expand Down
16 changes: 8 additions & 8 deletions spec/acceptance/xtypes/jenkins_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# on existing state as a performance optimization.
describe 'jenkins_job', order: :defined do
let(:test_build_job) do
example = <<~'EOS'
example = <<~EOS
<?xml version='1.0' encoding='UTF-8'?>
<project>
<actions/>
Expand Down Expand Up @@ -34,7 +34,7 @@
end

let(:test_folder_job) do
example = <<~'EOS'
example = <<~EOS
<?xml version="1.0" encoding="UTF-8"?><com.cloudbees.hudson.plugins.folder.Folder plugin="[email protected]">
<properties/>
<views>
Expand Down Expand Up @@ -65,7 +65,7 @@
include jenkins::cli::config
jenkins_job { 'foo':
ensure => present,
config => \'#{test_build_job}\',
config => '#{test_build_job}',
}
EOS

Expand Down Expand Up @@ -118,17 +118,17 @@
#{manifest}
jenkins_job { 'foo':
ensure => present,
config => \'#{test_folder_job}\',
config => '#{test_folder_job}',
}
jenkins_job { 'foo/bar':
ensure => present,
config => \'#{test_folder_job}\',
config => '#{test_folder_job}',
}
jenkins_job { 'foo/bar/baz':
ensure => present,
config => \'#{test_build_job}\',
config => '#{test_build_job}',
}
EOS

Expand Down Expand Up @@ -190,7 +190,7 @@
#{super()}
jenkins_job { 'foo':
ensure => present,
config => \'#{test_build_job}\',
config => '#{test_build_job}',
}
PUPPET
end
Expand All @@ -204,7 +204,7 @@
#{super()}
jenkins_job { 'foo':
ensure => present,
config => \'#{test_folder_job}\',
config => '#{test_folder_job}',
}
PUPPET
end
Expand Down
4 changes: 2 additions & 2 deletions spec/defines/jenkins_credentials_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
it {
is_expected.to contain_jenkins__cli__exec('create-jenkins-credentials-foo').with(command: ['create_or_update_credentials', title.to_s, "'mypass'",
"''", "'Managed by Puppet'", "''"],
unless: "for i in \$(seq 1 10); do \$HELPER_CMD credential_info #{title} && break || sleep 10; done | grep #{title}")
unless: "for i in $(seq 1 10); do $HELPER_CMD credential_info #{title} && break || sleep 10; done | grep #{title}")
}
end

Expand All @@ -65,7 +65,7 @@
it {
is_expected.to contain_jenkins__cli__exec('create-jenkins-credentials-foo').with(command: ['create_or_update_credentials', title.to_s, "'mypass'",
"'e94d3b98-5ba4-43b9-89ed-79a08ea97f6f'", "'Managed by Puppet'", "''"],
unless: "for i in \$(seq 1 10); do \$HELPER_CMD credential_info #{title} && break || sleep 10; done | grep #{title}")
unless: "for i in $(seq 1 10); do $HELPER_CMD credential_info #{title} && break || sleep 10; done | grep #{title}")
}
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/puppet/x/jenkins/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
# we are relying on a side effect of this method being to test features /
# load libs
describe '#initialize' do
it { expect(described_class.new).to be_kind_of described_class }
it { expect(described_class.new).to be_a described_class }
end

describe '#[]' do
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/puppet/x/spec_jenkins_providers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
context 'feature :retries' do
it do
expect(confines).to include(
be_kind_of(Puppet::Confine::Feature).
be_a(Puppet::Confine::Feature).
and(have_attributes(values: [:retries]))
)
end
Expand All @@ -24,7 +24,7 @@
context 'commands :java' do
it do
expect(confines).to include(
be_kind_of(Puppet::Confine::Exists).
be_a(Puppet::Confine::Exists).
and(have_attributes(values: ['java']))
)
end
Expand Down

0 comments on commit b6608c3

Please sign in to comment.