Skip to content

Commit 2d51f29

Browse files
authored
Merge pull request #83 from bastelfreak/rubocop2
Update rubocop to latest version
2 parents f2f24d5 + a6dd9e6 commit 2d51f29

File tree

82 files changed

+277
-244
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+277
-244
lines changed

.rubocop.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@ AllCops:
1010

1111
require:
1212
- rubocop-performance
13+
- rubocop-rake
1314
- rubocop-rspec
1415

15-
plugins:
16-
- rubocop-capybara
17-
1816
Layout/LineLength:
1917
Enabled: false
2018

.rubocop_todo.yml

Lines changed: 54 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,80 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config --no-auto-gen-timestamp`
3-
# using RuboCop version 1.78.0.
3+
# using RuboCop version 1.84.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

9-
# Offense count: 2
10-
# Configuration parameters: EnforcedStyle, AllowedPatterns, ForbiddenIdentifiers, ForbiddenPatterns.
11-
# SupportedStyles: snake_case, camelCase
12-
# ForbiddenIdentifiers: __id__, __send__
13-
Naming/MethodName:
14-
Exclude:
15-
- 'spec/mocks/win32ole.rb'
16-
- 'spec/mocks/ffi.rb'
17-
- 'spec/facter/util/windows/network_utils_spec.rb'
18-
199
# Offense count: 3
2010
# This cop supports safe autocorrection (--autocorrect).
2111
Performance/RegexpMatch:
2212
Exclude:
2313
- 'install.rb'
2414

15+
# Offense count: 1
16+
RSpec/IdenticalEqualityAssertion:
17+
Exclude:
18+
- 'spec/facter/util/resolvers/ssh_helper_spec.rb'
19+
20+
# Offense count: 50
21+
# Configuration parameters: Max, AllowedIdentifiers, AllowedPatterns.
22+
RSpec/IndexedLet:
23+
Enabled: false
24+
25+
# Offense count: 1
26+
# This cop supports safe autocorrection (--autocorrect).
27+
RSpec/MatchArray:
28+
Exclude:
29+
- 'spec/facter/facts/solaris/ldom_spec.rb'
30+
31+
# Offense count: 18
32+
# Configuration parameters: AllowedPatterns.
33+
# AllowedPatterns: ^expect_, ^assert_
34+
RSpec/NoExpectationExample:
35+
Exclude:
36+
- 'spec/custom_facts/core/execution/fact_manager_spec.rb'
37+
- 'spec/custom_facts/core/resolvable_spec.rb'
38+
- 'spec/custom_facts/core/suitable_spec.rb'
39+
- 'spec/custom_facts/util/collection_spec.rb'
40+
- 'spec/custom_facts/util/parser_spec.rb'
41+
- 'spec/facter/resolvers/ec2_spec.rb'
42+
43+
# Offense count: 128
44+
# This cop supports unsafe autocorrection (--autocorrect-all).
45+
RSpec/ReceiveMessages:
46+
Enabled: false
47+
2548
# Offense count: 70
26-
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
27-
# Include: **/*_spec*rb*, **/spec/**/*
28-
RSpec/FilePath:
49+
# Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata, InflectorPath, EnforcedInflector.
50+
# SupportedInflectors: default, active_support
51+
RSpec/SpecFilePathFormat:
2952
Enabled: false
3053

54+
# Offense count: 18
55+
# This cop supports unsafe autocorrection (--autocorrect-all).
56+
RSpec/VerifiedDoubleReference:
57+
Exclude:
58+
- 'spec/facter/resolvers/aix/serialnumber_spec.rb'
59+
- 'spec/facter/resolvers/bsd/ffi_helper_spec.rb'
60+
- 'spec/facter/resolvers/solaris/mountpoints_spec.rb'
61+
- 'spec/facter/resolvers/windows/fips_spec.rb'
62+
- 'spec/facter/resolvers/windows/netkvm_spec.rb'
63+
- 'spec/facter/resolvers/windows/networking_spec.rb'
64+
- 'spec/facter/resolvers/windows/product_release_spec.rb'
65+
- 'spec/facter/resolvers/windows/virtualization_spec.rb'
66+
- 'spec/facter/util/windows/network_utils_spec.rb'
67+
- 'spec/framework/core/options/option_store_spec.rb'
68+
- 'spec/framework/core/options_spec.rb'
69+
3170
# Offense count: 14
3271
Style/ClassVars:
3372
Exclude:
3473
- 'lib/facter/framework/logging/logger.rb'
3574
- 'spec/custom_facts/puppetlabs_spec/files.rb'
3675
- 'spec/framework/logging/logger_spec.rb'
3776

38-
# Offense count: 981
77+
# Offense count: 985
3978
# Configuration parameters: AllowedConstants.
4079
Style/Documentation:
4180
Enabled: false

lib/facter/framework/cli/cli.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,11 @@ def add_commands_to_help
201201
Cli.commands.values
202202
.select { |command_class| command_class.instance_of?(Thor::Command) }
203203
.each do |command|
204-
help_command_options << build_option(
205-
command['name'],
206-
[command['usage'].split(',')[1]],
207-
command['description']
208-
)
204+
help_command_options << build_option(
205+
command['name'],
206+
[command['usage'].split(',')[1]],
207+
command['description']
208+
)
209209
end
210210

211211
help_command_options

lib/facter/resolvers/linux/processors.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def physical_devices_count
7070
.select { |dir| dir =~ /cpu[0-9]+$/ }
7171
.select { |dir| File.exist?("/sys/devices/system/cpu/#{dir}/topology/physical_package_id") }
7272
.map do |dir|
73-
Facter::Util::FileHelper.safe_read("/sys/devices/system/cpu/#{dir}/topology/physical_package_id").strip
73+
Facter::Util::FileHelper.safe_read("/sys/devices/system/cpu/#{dir}/topology/physical_package_id").strip
7474
end
7575
.uniq.count
7676
end

openfact.gemspec

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@ Gem::Specification.new do |spec|
3838
spec.add_development_dependency 'ffi', '>= 1.15.5', '< 1.18.0', '!= 1.16.0', '!= 1.16.1', '!= 1.16.2'
3939
spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.6'
4040
spec.add_development_dependency 'rspec', '~> 3.0'
41-
spec.add_development_dependency 'rubocop', '~> 1.28', '< 1.79'
42-
spec.add_development_dependency 'rubocop-performance', '~> 1.5.2'
43-
spec.add_development_dependency 'rubocop-rspec', '~> 2.10' # last version to support 2.5
41+
spec.add_development_dependency 'rubocop', '~> 1.28', '< 1.85'
42+
spec.add_development_dependency 'rubocop-performance', '~> 1.5'
43+
spec.add_development_dependency 'rubocop-rake', '< 1'
44+
spec.add_development_dependency 'rubocop-rspec', '>= 2.10', '< 4'
4445
spec.add_development_dependency 'simplecov', '~> 0.17'
4546
spec.add_development_dependency 'sys-filesystem', '~> 1.4'
4647
spec.add_development_dependency 'webmock', '~> 3.12'

spec/custom_facts/core/aggregate_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
let(:logger) { Facter::Log.class_variable_get(:@@logger) }
88

99
it 'can be resolved' do
10-
expect(aggregate_res).to be_a_kind_of LegacyFacter::Core::Resolvable
10+
expect(aggregate_res).to be_a LegacyFacter::Core::Resolvable
1111
end
1212

1313
it 'can be confined and weighted' do
14-
expect(aggregate_res).to be_a_kind_of LegacyFacter::Core::Suitable
14+
expect(aggregate_res).to be_a LegacyFacter::Core::Suitable
1515
end
1616

1717
it 'can be compared' do
@@ -92,7 +92,7 @@
9292
end
9393

9494
output = aggregate_res.value
95-
expect(output).to match_array(['foo', 'foo bar'])
95+
expect(output).to contain_exactly('foo', 'foo bar')
9696
end
9797

9898
it 'clones and freezes chunk results' do

spec/custom_facts/core/execution/posix_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424

2525
it 'returns nil if the binary is not executable' do
2626
allow(File).to receive(:executable?).with('/opt/foo').and_return(false)
27-
expect(posix_executor.which('/opt/foo')).to be nil
27+
expect(posix_executor.which('/opt/foo')).to be_nil
2828
end
2929

3030
it 'returns nil if the binary is not a file' do
3131
allow(File).to receive(:executable?).with('/opt/foo').and_return(true)
3232
allow(FileTest).to receive(:file?).with('/opt/foo').and_return false
33-
expect(posix_executor.which('/opt/foo')).to be nil
33+
expect(posix_executor.which('/opt/foo')).to be_nil
3434
end
3535
end
3636

@@ -46,7 +46,7 @@
4646
allow(File).to receive(:executable?).with('/bin/foo').and_return false
4747
allow(File).to receive(:executable?).with('/sbin/foo').and_return false
4848
allow(File).to receive(:executable?).with('/usr/sbin/foo').and_return false
49-
expect(posix_executor.which('foo')).to be nil
49+
expect(posix_executor.which('foo')).to be_nil
5050
end
5151
end
5252
end
@@ -88,7 +88,7 @@
8888

8989
it 'returns nil if not found' do
9090
allow(posix_executor).to receive(:which).with('foo').and_return nil
91-
expect(posix_executor.expand_command('foo -a | stuff >> /dev/null')).to be nil
91+
expect(posix_executor.expand_command('foo -a | stuff >> /dev/null')).to be_nil
9292
end
9393
end
9494

spec/custom_facts/core/execution/windows_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
end
4545

4646
it 'disallows other builtin windows commands' do
47-
expect(executor.which('dir')).to eq nil
47+
expect(executor.which('dir')).to be_nil
4848
end
4949
end
5050

@@ -64,13 +64,13 @@
6464
it 'returns nil if the binary path is not executable' do
6565
allow(File).to receive(:executable?).with('C:\Tools\foo.exe').and_return false
6666

67-
expect(executor.which('C:\Tools\foo.exe')).to be nil
67+
expect(executor.which('C:\Tools\foo.exe')).to be_nil
6868
end
6969

7070
it 'returns nil if the binary is not executable' do
7171
allow(File).to receive(:executable?).with('\\\\remote\dir\foo.exe').and_return false
7272

73-
expect(executor.which('\\\\remote\dir\foo.exe')).to be nil
73+
expect(executor.which('\\\\remote\dir\foo.exe')).to be_nil
7474
end
7575
end
7676

@@ -108,7 +108,7 @@
108108
allow(File).to receive(:executable?).with('C:\Windows\foo.exe').and_return false
109109
allow(File).to receive(:executable?).with('C:\Windows\System32\Wbem\foo.exe').and_return false
110110

111-
expect(executor.which('foo.exe')).to be nil
111+
expect(executor.which('foo.exe')).to be_nil
112112
end
113113
end
114114
end
@@ -129,7 +129,7 @@
129129

130130
it 'does not expand single quoted binary' do
131131
allow(executor).to receive(:which).with('\'C:\My').and_return nil
132-
expect(executor.expand_command('\'C:\My Tools\foo.exe\' /a /b')).to be nil
132+
expect(executor.expand_command('\'C:\My Tools\foo.exe\' /a /b')).to be_nil
133133
end
134134

135135
it 'quotes expanded binary if found in path with spaces' do
@@ -146,7 +146,7 @@
146146

147147
it 'returns nil if command not found' do
148148
allow(executor).to receive(:which).with('foo').and_return nil
149-
expect(executor.expand_command('foo /a | stuff >> NUL')).to be nil
149+
expect(executor.expand_command('foo /a | stuff >> NUL')).to be_nil
150150
end
151151
end
152152

spec/custom_facts/util/collection_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def load(collection)
144144

145145
it 'returns nil if it cannot find or load the fact' do
146146
allow(collection.internal_loader).to receive(:load).with(:testing)
147-
expect(collection.fact('testing')).to be nil
147+
expect(collection.fact('testing')).to be_nil
148148
end
149149
end
150150

@@ -268,7 +268,7 @@ def load(collection)
268268
it 'does not include facts that did not return a value' do
269269
collection.add(:two, value: nil)
270270

271-
expect(collection.to_hash).not_to be_include(:two)
271+
expect(collection.to_hash).not_to include(:two)
272272
end
273273
end
274274

@@ -299,7 +299,7 @@ def load(collection)
299299
facts[fact] = value
300300
end
301301

302-
expect(facts).not_to be_include('nil_fact')
302+
expect(facts).not_to include('nil_fact')
303303
end
304304
end
305305

spec/custom_facts/util/config_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
it 'returns nil for windows' do
114114
allow(LegacyFacter::Util::Config).to receive(:windows?).and_return(true)
115115
LegacyFacter::Util::Config.setup_default_override_binary_dir
116-
expect(LegacyFacter::Util::Config.override_binary_dir).to eq nil
116+
expect(LegacyFacter::Util::Config.override_binary_dir).to be_nil
117117
end
118118

119119
it 'outputs new values when explicitly set' do

0 commit comments

Comments
 (0)