Skip to content

Commit cfe2142

Browse files
committed
rubocop: autofix
1 parent 155a572 commit cfe2142

File tree

7 files changed

+27
-54
lines changed

7 files changed

+27
-54
lines changed

.rubocop_todo.yml

Lines changed: 5 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
11
# This configuration was generated by
2-
# `rubocop --auto-gen-config`
3-
# on 2024-06-09 17:48:43 UTC using RuboCop version 1.63.5.
2+
# `rubocop --auto-gen-config --no-auto-gen-timestamp`
3+
# using RuboCop version 1.75.8.
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: 1
10-
# This cop supports unsafe autocorrection (--autocorrect-all).
11-
Performance/MapCompact:
12-
Exclude:
13-
- 'lib/rspec-puppet-facts.rb'
14-
159
# Offense count: 29
1610
# Configuration parameters: Prefixes, AllowedPatterns.
1711
# Prefixes: when, with, without
1812
RSpec/ContextWording:
1913
Exclude:
2014
- 'spec/rspec_puppet_facts_spec.rb'
2115

22-
# Offense count: 7
16+
# Offense count: 6
2317
# Configuration parameters: CountAsOne.
2418
RSpec/ExampleLength:
2519
Max: 13
@@ -29,14 +23,6 @@ RSpec/ExpectInHook:
2923
Exclude:
3024
- 'spec/rspec_puppet_facts_spec.rb'
3125

32-
# Offense count: 8
33-
# This cop supports safe autocorrection (--autocorrect).
34-
# Configuration parameters: EnforcedStyle.
35-
# SupportedStyles: single_line_only, single_statement_only, disallow, require_implicit
36-
RSpec/ImplicitSubject:
37-
Exclude:
38-
- 'spec/rspec_puppet_facts_spec.rb'
39-
4026
# Offense count: 4
4127
RSpec/LeakyConstantDeclaration:
4228
Exclude:
@@ -52,7 +38,7 @@ RSpec/MessageSpies:
5238
RSpec/MultipleExpectations:
5339
Max: 2
5440

55-
# Offense count: 40
41+
# Offense count: 48
5642
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
5743
# SupportedStyles: always, named_only
5844
RSpec/NamedSubject:
@@ -69,39 +55,18 @@ RSpec/StubbedMock:
6955
Exclude:
7056
- 'spec/rspec_puppet_facts_spec.rb'
7157

72-
# Offense count: 2
73-
# This cop supports safe autocorrection (--autocorrect).
74-
Rake/Desc:
75-
Exclude:
76-
- 'Rakefile'
77-
78-
# Offense count: 6
79-
# This cop supports unsafe autocorrection (--autocorrect-all).
80-
# Configuration parameters: EnforcedStyle.
81-
# SupportedStyles: always, always_true, never
82-
Style/FrozenStringLiteralComment:
83-
Exclude:
84-
- 'Gemfile'
85-
- 'Rakefile'
86-
- 'lib/rspec-puppet-facts.rb'
87-
- 'lib/rspec-puppet-facts/version.rb'
88-
- 'spec/rspec_puppet_facts_spec.rb'
89-
- 'spec/spec_helper.rb'
90-
9158
# Offense count: 1
9259
Style/MixinUsage:
9360
Exclude:
9461
- 'spec/spec_helper.rb'
9562

96-
# Offense count: 3
63+
# Offense count: 1
9764
# This cop supports unsafe autocorrection (--autocorrect-all).
9865
# Configuration parameters: EnforcedStyle.
9966
# SupportedStyles: literals, strict
10067
Style/MutableConstant:
10168
Exclude:
10269
- 'lib/rspec-puppet-facts.rb'
103-
- 'lib/rspec-puppet-facts/version.rb'
104-
- 'spec/rspec_puppet_facts_spec.rb'
10570

10671
# Offense count: 1
10772
# This cop supports unsafe autocorrection (--autocorrect-all).
@@ -112,12 +77,6 @@ Style/RedundantArgument:
11277

11378
# Offense count: 1
11479
# This cop supports unsafe autocorrection (--autocorrect-all).
115-
Style/RedundantSort:
116-
Exclude:
117-
- 'lib/rspec-puppet-facts.rb'
118-
119-
# Offense count: 2
120-
# This cop supports unsafe autocorrection (--autocorrect-all).
12180
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
12281
# AllowedMethods: present?, blank?, presence, try, try!
12382
Style/SafeNavigation:

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
24

35
gemspec

Rakefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
PUPPET_VERSIONS_PATH = File.join(__dir__, 'ext', 'puppet_agent_facter_versions.json')
24

35
begin
@@ -17,6 +19,7 @@ task :dump_commit do
1719
end
1820

1921
namespace :puppet_versions do
22+
desc 'updates the vendored list of puppet versions & components'
2023
task :update do
2124
require 'net/http'
2225
require 'net/https'
@@ -41,6 +44,7 @@ namespace :puppet_versions do
4144
File.write(PUPPET_VERSIONS_PATH, "#{JSON.pretty_generate(data.to_h)}\n")
4245
end
4346

47+
desc 'runs all tests and verifies vendored component list'
4448
task :test do
4549
Rake::Task['puppet_versions:update'].invoke
4650

lib/rspec-puppet-facts.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'facter'
24
require 'facterdb'
35
require 'json'

lib/rspec-puppet-facts/version.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module RspecPuppetFacts
24
# This module contains the current version constant
35
module Version

spec/rspec_puppet_facts_spec.rb

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'spec_helper'
24
require 'json'
35
require 'stringio'
@@ -204,7 +206,7 @@
204206
end
205207

206208
it 'returns a hash' do
207-
is_expected.to be_a Hash
209+
expect(subject).to be_a Hash
208210
end
209211

210212
it 'returns supported OS' do
@@ -276,7 +278,7 @@
276278
end
277279

278280
it 'returns a hash' do
279-
is_expected.to be_a Hash
281+
expect(subject).to be_a Hash
280282
end
281283

282284
it 'returns supported OS' do
@@ -639,7 +641,7 @@
639641
end
640642

641643
it 'returns facts from the specified default Facter version' do
642-
is_expected.to match(
644+
expect(subject).to match(
643645
'centos-9-x86_64' => include(
644646
facterversion: /\A4\.6\./,
645647
),
@@ -662,7 +664,7 @@
662664
end
663665

664666
it 'returns facts from a facter version matching version and below' do
665-
is_expected.to match(
667+
expect(subject).to match(
666668
'centos-9-x86_64' => include(
667669
facterversion: /\A4\.[0-7]\./,
668670
),
@@ -691,7 +693,7 @@
691693
end
692694

693695
it 'returns facts from a facter version matching 4.6' do
694-
is_expected.to match('centos-9-x86_64' => include(facterversion: '4.6.1'))
696+
expect(subject).to match('centos-9-x86_64' => include(facterversion: '4.6.1'))
695697
end
696698
end
697699

@@ -706,7 +708,7 @@
706708
end
707709

708710
it 'returns facts from a facter version matching 4.6.1' do
709-
is_expected.to match('centos-9-x86_64' => include(facterversion: '4.6.1'))
711+
expect(subject).to match('centos-9-x86_64' => include(facterversion: '4.6.1'))
710712
end
711713
end
712714

@@ -747,11 +749,11 @@
747749
end
748750

749751
it 'returns CentOS facts from a facter version matching 4.5' do
750-
is_expected.to include('centos-9-x86_64' => include(facterversion: '4.5.2'))
752+
expect(subject).to include('centos-9-x86_64' => include(facterversion: '4.5.2'))
751753
end
752754

753755
it 'returns Debian facts from a facter version matching 4.6.1' do
754-
is_expected.to include('debian-12-x86_64' => include(facterversion: '4.6.1'))
756+
expect(subject).to include('debian-12-x86_64' => include(facterversion: '4.6.1'))
755757
end
756758
end
757759
end

spec/spec_helper.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'rspec'
24
require 'rspec-puppet-facts'
35
include RspecPuppetFacts

0 commit comments

Comments
 (0)