Skip to content

Commit 84fd2a7

Browse files
Merge pull request #468 from bastelfreak/vr
rubocop: Fix style cops
2 parents 58aa94b + ff7247e commit 84fd2a7

File tree

11 files changed

+43
-104
lines changed

11 files changed

+43
-104
lines changed

.rubocop_todo.yml

Lines changed: 1 addition & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2024-06-09 12:47:09 UTC using RuboCop version 1.63.5.
3+
# on 2024-06-28 12:36:37 UTC using RuboCop version 1.64.1.
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
@@ -18,14 +18,6 @@ Lint/MixedRegexpCaptureTypes:
1818
Exclude:
1919
- 'Gemfile'
2020

21-
# Offense count: 1
22-
# This cop supports safe autocorrection (--autocorrect).
23-
# Configuration parameters: EnforcedStyle.
24-
# SupportedStyles: strict, consistent
25-
Lint/SymbolConversion:
26-
Exclude:
27-
- 'lib/puppetlabs_spec_helper/puppetlabs_spec/puppet_internals.rb'
28-
2921
# Offense count: 7
3022
# Configuration parameters: Prefixes, AllowedPatterns.
3123
# Prefixes: when, with, without
@@ -99,12 +91,6 @@ Security/Eval:
9991
Exclude:
10092
- 'lib/puppetlabs_spec_helper/tasks/fixtures.rb'
10193

102-
# Offense count: 1
103-
# This cop supports unsafe autocorrection (--autocorrect-all).
104-
Style/CombinableLoops:
105-
Exclude:
106-
- 'lib/puppetlabs_spec_helper/tasks/fixtures.rb'
107-
10894
# Offense count: 1
10995
# This cop supports safe autocorrection (--autocorrect).
11096
# Configuration parameters: AllowedVars.
@@ -125,14 +111,6 @@ Style/GlobalVars:
125111
Exclude:
126112
- 'lib/puppetlabs_spec_helper/puppetlabs_spec/files.rb'
127113

128-
# Offense count: 4
129-
# This cop supports unsafe autocorrection (--autocorrect-all).
130-
# Configuration parameters: AllowedReceivers.
131-
# AllowedReceivers: Thread.current
132-
Style/HashEachMethods:
133-
Exclude:
134-
- 'lib/puppetlabs_spec_helper/tasks/fixtures.rb'
135-
136114
# Offense count: 1
137115
Style/MixinUsage:
138116
Exclude:
@@ -152,42 +130,3 @@ Style/RegexpLiteral:
152130
Exclude:
153131
- 'Gemfile'
154132
- 'spec/unit/puppetlabs_spec_helper/tasks/fixtures_spec.rb'
155-
156-
# Offense count: 2
157-
# This cop supports safe autocorrection (--autocorrect).
158-
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
159-
# SupportedStyles: single_quotes, double_quotes
160-
Style/StringLiterals:
161-
Exclude:
162-
- 'Rakefile'
163-
164-
# Offense count: 2
165-
# This cop supports safe autocorrection (--autocorrect).
166-
# Configuration parameters: EnforcedStyle, AllowSafeAssignment.
167-
# SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex
168-
Style/TernaryParentheses:
169-
Exclude:
170-
- 'lib/puppetlabs_spec_helper/tasks/fixtures.rb'
171-
- 'spec/watchr.rb'
172-
173-
# Offense count: 12
174-
# This cop supports safe autocorrection (--autocorrect).
175-
# Configuration parameters: EnforcedStyleForMultiline.
176-
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
177-
Style/TrailingCommaInArrayLiteral:
178-
Exclude:
179-
- 'lib/puppetlabs_spec_helper/module_spec_helper.rb'
180-
- 'lib/puppetlabs_spec_helper/tasks/check_symlinks.rb'
181-
- 'spec/spec_helper.rb'
182-
- 'spec/unit/puppetlabs_spec_helper/tasks/check_symlinks_spec.rb'
183-
- 'spec/unit/puppetlabs_spec_helper/tasks/check_test_file_spec.rb'
184-
185-
# Offense count: 26
186-
# This cop supports safe autocorrection (--autocorrect).
187-
# Configuration parameters: EnforcedStyleForMultiline.
188-
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
189-
Style/TrailingCommaInHashLiteral:
190-
Exclude:
191-
- 'lib/puppetlabs_spec_helper/rake_tasks.rb'
192-
- 'spec/unit/puppetlabs_spec_helper/tasks/check_symlinks_spec.rb'
193-
- 'spec/unit/puppetlabs_spec_helper/tasks/fixture_helpers_spec.rb'

Rakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ require 'bundler/gem_tasks'
44
require 'rspec/core/rake_task'
55

66
RSpec::Core::RakeTask.new(:spec) do |t|
7-
t.exclude_pattern = "spec/acceptance/**/*.rb"
7+
t.exclude_pattern = 'spec/acceptance/**/*.rb'
88
end
99

1010
namespace :spec do
@@ -16,7 +16,7 @@ namespace :spec do
1616
end
1717

1818
RSpec::Core::RakeTask.new(:acceptance) do |t|
19-
t.pattern = "spec/acceptance/**/*.rb"
19+
t.pattern = 'spec/acceptance/**/*.rb'
2020
end
2121

2222
require 'yard'

lib/puppetlabs_spec_helper/module_spec_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def verify_contents(subject, title, expected_lines)
3131

3232
SimpleCov.formatters = [
3333
SimpleCov::Formatter::HTMLFormatter,
34-
SimpleCov::Formatter::Console
34+
SimpleCov::Formatter::Console,
3535
]
3636

3737
begin

lib/puppetlabs_spec_helper/rake_tasks.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -381,16 +381,16 @@ def changelog_future_release
381381
config.configure_sections = {
382382
'Changed' => {
383383
'prefix' => '### Changed',
384-
'labels' => ['backwards-incompatible']
384+
'labels' => ['backwards-incompatible'],
385385
},
386386
'Added' => {
387387
'prefix' => '### Added',
388-
'labels' => %w[feature enhancement]
388+
'labels' => %w[feature enhancement],
389389
},
390390
'Fixed' => {
391391
'prefix' => '### Fixed',
392-
'labels' => ['bugfix']
393-
}
392+
'labels' => ['bugfix'],
393+
},
394394
}
395395
end
396396
else

lib/puppetlabs_spec_helper/tasks/check_symlinks.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ class CheckSymlinks
99
DEFAULT_IGNORED = [
1010
'/.git/',
1111
'/.bundle/',
12-
'/vendor/'
12+
'/vendor/',
1313
].freeze
1414

1515
IGNORE_LIST_FILES = [
1616
'.pdkignore',
17-
'.gitignore'
17+
'.gitignore',
1818
].freeze
1919

2020
def check(dir = Dir.pwd)

lib/puppetlabs_spec_helper/tasks/fixtures.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def fixtures(category)
106106
end
107107

108108
fixtures = fixtures['fixtures']
109-
fixtures['symlinks'] = fixtures['symlinks'].nil? || fixtures['symlinks'].empty? ? auto_symlink : auto_symlink.merge!(fixtures['symlinks'])
109+
fixtures['symlinks'] = (fixtures['symlinks'].nil? || fixtures['symlinks'].empty?) ? auto_symlink : auto_symlink.merge!(fixtures['symlinks'])
110110

111111
result = {}
112112
if fixtures.include?(category) && !fixtures[category].nil?

spec/spec_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
SimpleCov.formatters = [
1212
SimpleCov::Formatter::HTMLFormatter,
13-
SimpleCov::Formatter::Console
13+
SimpleCov::Formatter::Console,
1414
]
1515

1616
SimpleCov.start do

spec/unit/puppetlabs_spec_helper/tasks/check_symlinks_spec.rb

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
let(:test_files) do
3232
[
3333
File.join(Dir.pwd, 'files', 'a_file.pp'),
34-
File.join(Dir.pwd, 'files', 'another_file.pp')
34+
File.join(Dir.pwd, 'files', 'another_file.pp'),
3535
]
3636
end
3737

@@ -43,13 +43,13 @@
4343
context 'when there is a symlink present' do
4444
let(:test_files) do
4545
[
46-
File.join(Dir.pwd, 'files', 'a_file.pp')
46+
File.join(Dir.pwd, 'files', 'a_file.pp'),
4747
]
4848
end
4949

5050
let(:symlinks) do
5151
{
52-
File.join(Dir.pwd, 'files', 'a_symlink.pp') => File.join(Dir.pwd, 'files', 'a_file.pp')
52+
File.join(Dir.pwd, 'files', 'a_symlink.pp') => File.join(Dir.pwd, 'files', 'a_file.pp'),
5353
}
5454
end
5555

@@ -63,13 +63,13 @@
6363
context 'when there are symlinks under .git/' do
6464
let(:test_files) do
6565
[
66-
File.join(Dir.pwd, 'files', 'a_file.pp')
66+
File.join(Dir.pwd, 'files', 'a_file.pp'),
6767
]
6868
end
6969

7070
let(:symlinks) do
7171
{
72-
File.join(Dir.pwd, '.git', 'a_symlink.pp') => File.join(Dir.pwd, 'files', 'a_file.pp')
72+
File.join(Dir.pwd, '.git', 'a_symlink.pp') => File.join(Dir.pwd, 'files', 'a_file.pp'),
7373
}
7474
end
7575

@@ -81,13 +81,13 @@
8181
context 'when there are symlinks under .bundle/' do
8282
let(:test_files) do
8383
[
84-
File.join(Dir.pwd, 'files', 'a_file.pp')
84+
File.join(Dir.pwd, 'files', 'a_file.pp'),
8585
]
8686
end
8787

8888
let(:symlinks) do
8989
{
90-
File.join(Dir.pwd, '.bundle', 'a_symlink.pp') => File.join(Dir.pwd, 'files', 'a_file.pp')
90+
File.join(Dir.pwd, '.bundle', 'a_symlink.pp') => File.join(Dir.pwd, 'files', 'a_file.pp'),
9191
}
9292
end
9393

@@ -99,13 +99,13 @@
9999
context 'when there are symlinks under vendor/' do
100100
let(:test_files) do
101101
[
102-
File.join(Dir.pwd, 'files', 'a_file.pp')
102+
File.join(Dir.pwd, 'files', 'a_file.pp'),
103103
]
104104
end
105105

106106
let(:symlinks) do
107107
{
108-
File.join(Dir.pwd, 'vendor', 'a_symlink.pp') => File.join(Dir.pwd, 'files', 'a_file.pp')
108+
File.join(Dir.pwd, 'vendor', 'a_symlink.pp') => File.join(Dir.pwd, 'files', 'a_file.pp'),
109109
}
110110
end
111111

@@ -121,13 +121,13 @@
121121

122122
let(:test_files) do
123123
[
124-
File.join(Dir.pwd, 'files', 'a_file.pp')
124+
File.join(Dir.pwd, 'files', 'a_file.pp'),
125125
]
126126
end
127127

128128
let(:symlinks) do
129129
{
130-
File.join(Dir.pwd, 'a_directory', 'a_symlink.pp') => File.join(Dir.pwd, 'files', 'a_file.pp')
130+
File.join(Dir.pwd, 'a_directory', 'a_symlink.pp') => File.join(Dir.pwd, 'files', 'a_file.pp'),
131131
}
132132
end
133133

@@ -145,13 +145,13 @@
145145

146146
let(:test_files) do
147147
[
148-
File.join(Dir.pwd, 'files', 'a_file.pp')
148+
File.join(Dir.pwd, 'files', 'a_file.pp'),
149149
]
150150
end
151151

152152
let(:symlinks) do
153153
{
154-
File.join(Dir.pwd, 'another_directory', 'a_symlink.pp') => File.join(Dir.pwd, 'files', 'a_file.pp')
154+
File.join(Dir.pwd, 'another_directory', 'a_symlink.pp') => File.join(Dir.pwd, 'files', 'a_file.pp'),
155155
}
156156
end
157157

spec/unit/puppetlabs_spec_helper/tasks/check_test_file_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
let(:test_files) do
1515
[
1616
File.join(Dir.pwd, 'tests', 'an_example.pp'),
17-
File.join(Dir.pwd, 'tests', 'deep', 'directory', 'structure', 'another_example.pp')
17+
File.join(Dir.pwd, 'tests', 'deep', 'directory', 'structure', 'another_example.pp'),
1818
]
1919
end
2020

spec/unit/puppetlabs_spec_helper/tasks/fixture_helpers_spec.rb

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141
'branch' => nil,
142142
'scm' => nil,
143143
'flags' => nil,
144-
'subdir' => nil
144+
'subdir' => nil,
145145
},
146146
)
147147
end
@@ -159,7 +159,7 @@
159159
'branch' => nil,
160160
'scm' => nil,
161161
'flags' => '--module_repository=https://myforge.example.com/',
162-
'subdir' => nil
162+
'subdir' => nil,
163163
},
164164
)
165165
end
@@ -170,7 +170,7 @@
170170
allow(File).to receive(:exist?).with('.fixtures.yml').and_return true
171171
allow(YAML).to receive(:load_file).with('.fixtures.yml').and_return(
172172
'fixtures' => {
173-
'repositories' => { 'stdlib' => 'https://github.com/puppetlabs/puppetlabs-stdlib.git' }
173+
'repositories' => { 'stdlib' => 'https://github.com/puppetlabs/puppetlabs-stdlib.git' },
174174
},
175175
)
176176
end
@@ -183,7 +183,7 @@
183183
'branch' => nil,
184184
'scm' => nil,
185185
'flags' => nil,
186-
'subdir' => nil
186+
'subdir' => nil,
187187
},
188188
)
189189
end
@@ -198,9 +198,9 @@
198198
'stdlib' => {
199199
'scm' => 'git',
200200
'repo' => 'https://github.com/puppetlabs/puppetlabs-stdlib.git',
201-
'ref' => 'this/is/a/branch'
202-
}
203-
}
201+
'ref' => 'this/is/a/branch',
202+
},
203+
},
204204
},
205205
)
206206
end
@@ -222,9 +222,9 @@ def stub_fixtures(data)
222222
'forge_modules' => {
223223
'stdlib' => {
224224
'repo' => 'puppetlabs-stdlib',
225-
'puppet_version' => Puppet::PUPPETVERSION
226-
}
227-
}
225+
'puppet_version' => Puppet::PUPPETVERSION,
226+
},
227+
},
228228
},
229229
)
230230
expect(helper.fixtures('forge_modules')).to include('puppetlabs-stdlib')
@@ -236,9 +236,9 @@ def stub_fixtures(data)
236236
'forge_modules' => {
237237
'stdlib' => {
238238
'repo' => 'puppetlabs-stdlib',
239-
'puppet_version' => '>= 999.9.9'
240-
}
241-
}
239+
'puppet_version' => '>= 999.9.9',
240+
},
241+
},
242242
},
243243
)
244244
expect(helper.fixtures('forge_modules')).to eq({})
@@ -250,9 +250,9 @@ def stub_fixtures(data)
250250
'forge_modules' => {
251251
'stdlib' => {
252252
'repo' => 'puppetlabs-stdlib',
253-
'puppet_version' => Puppet::PUPPETVERSION
254-
}
255-
}
253+
'puppet_version' => Puppet::PUPPETVERSION,
254+
},
255+
},
256256
},
257257
)
258258
expect(helper.fixtures('forge_modules')).to include('puppetlabs-stdlib')

spec/watchr.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def growl(message)
1111
title = 'Watchr Test Results'
1212
image = case message
1313
when /(\d+)\s+?(failure|error)/i
14-
Regexp.last_match(1).to_i == 0 ? '~/.watchr_images/passed.png' : '~/.watchr_images/failed.png'
14+
(Regexp.last_match(1).to_i == 0) ? '~/.watchr_images/passed.png' : '~/.watchr_images/failed.png'
1515
else
1616
'~/.watchr_images/unknown.png'
1717
end

0 commit comments

Comments
 (0)