Skip to content

Commit 0b42f0f

Browse files
committed
rubocop: Fix style cops
1 parent 3b85b2f commit 0b42f0f

File tree

6 files changed

+16
-65
lines changed

6 files changed

+16
-65
lines changed

.rubocop_todo.yml

+1-50
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-28 11:45:55 UTC using RuboCop version 1.64.1.
3+
# on 2024-06-28 12:03:58 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
@@ -63,55 +63,6 @@ Style/FetchEnvVar:
6363
Exclude:
6464
- 'Gemfile'
6565

66-
# Offense count: 1
67-
# This cop supports safe autocorrection (--autocorrect).
68-
# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
69-
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
70-
# SupportedShorthandSyntax: always, never, either, consistent, either_consistent
71-
Style/HashSyntax:
72-
Exclude:
73-
- 'Gemfile'
74-
75-
# Offense count: 2
76-
# This cop supports safe autocorrection (--autocorrect).
77-
Style/RedundantRegexpEscape:
78-
Exclude:
79-
- 'Gemfile'
80-
81-
# Offense count: 1
82-
# This cop supports safe autocorrection (--autocorrect).
83-
# Configuration parameters: EnforcedStyle, AllowInnerSlashes.
84-
# SupportedStyles: slashes, percent_r, mixed
85-
Style/RegexpLiteral:
86-
Exclude:
87-
- 'Gemfile'
88-
89-
# Offense count: 1
90-
# This cop supports safe autocorrection (--autocorrect).
91-
# Configuration parameters: MinSize.
92-
# SupportedStyles: percent, brackets
93-
Style/SymbolArray:
94-
EnforcedStyle: brackets
95-
96-
# Offense count: 7
97-
# This cop supports safe autocorrection (--autocorrect).
98-
# Configuration parameters: EnforcedStyleForMultiline.
99-
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
100-
Style/TrailingCommaInArrayLiteral:
101-
Exclude:
102-
- 'lib/puppet/modulebuilder/builder.rb'
103-
- 'spec/spec_helper.rb'
104-
- 'spec/unit/puppet/modulebuilder/builder_spec.rb'
105-
106-
# Offense count: 3
107-
# This cop supports safe autocorrection (--autocorrect).
108-
# Configuration parameters: EnforcedStyleForMultiline.
109-
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
110-
Style/TrailingCommaInHashLiteral:
111-
Exclude:
112-
- 'lib/puppet/modulebuilder/builder.rb'
113-
- 'spec/unit/puppet/modulebuilder/builder_spec.rb'
114-
11566
# Offense count: 9
11667
# This cop supports safe autocorrection (--autocorrect).
11768
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.

Gemfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ source 'https://rubygems.org'
66
gemspec
77

88
def location_for(place_or_version, fake_version = nil)
9-
git_url_regex = %r{\A(?<url>(https?|git)[:@][^#]*)(#(?<branch>.*))?}
10-
file_url_regex = %r{\Afile:\/\/(?<path>.*)}
9+
git_url_regex = /\A(?<url>(https?|git)[:@][^#]*)(#(?<branch>.*))?/
10+
file_url_regex = %r{\Afile://(?<path>.*)}
1111

1212
if place_or_version && (git_url = place_or_version.match(git_url_regex))
1313
[fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact
@@ -28,5 +28,5 @@ group :development do
2828
gem 'simplecov-console'
2929

3030
# Required for testing on Windows
31-
gem 'ffi', :platforms => [:x64_mingw]
31+
gem 'ffi', platforms: [:x64_mingw]
3232
end

Rakefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ namespace :spec do
1111
desc 'Run RSpec code examples with coverage collection'
1212
task :coverage do
1313
ENV['COVERAGE'] = 'yes'
14-
Rake::Task['spec'].execute
14+
Rake::Task['spec'].execute
1515
end
1616
end
1717

1818
RSpec::Core::RakeTask.new(:acceptance) do |t|
1919
t.pattern = 'spec/acceptance/**/*_spec.rb'
2020
end
2121

22-
task default: [:spec, :acceptance]
22+
task default: %i[spec acceptance]
2323

2424
begin
2525
require 'voxpupuli/rubocop/rake'

lib/puppet/modulebuilder/builder.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Builder
1313
'/checksums.json',
1414
'/REVISION',
1515
'/spec/fixtures/modules/',
16-
'/vendor/'
16+
'/vendor/',
1717
].freeze
1818

1919
attr_reader :destination, :logger
@@ -65,7 +65,7 @@ def build_dir
6565
def build_context
6666
{
6767
parent_dir: destination,
68-
build_dir_name: release_name
68+
build_dir_name: release_name,
6969
}.freeze
7070
end
7171

@@ -179,7 +179,7 @@ def ignore_file
179179
@ignore_file ||= [
180180
File.join(source, '.pdkignore'),
181181
File.join(source, '.pmtignore'),
182-
File.join(source, '.gitignore')
182+
File.join(source, '.gitignore'),
183183
].find { |file| file_exists?(file) && file_readable?(file) }
184184
end
185185

@@ -223,7 +223,7 @@ def build_package
223223
tar = Minitar::Output.new(gz)
224224
Find.find(build_context[:build_dir_name]) do |entry|
225225
entry_meta = {
226-
name: entry
226+
name: entry,
227227
}
228228

229229
orig_mode = File.stat(entry).mode
@@ -336,7 +336,7 @@ def package_already_exists?
336336
def release_name
337337
@release_name ||= [
338338
metadata['name'],
339-
metadata['version']
339+
metadata['version'],
340340
].join('-')
341341
end
342342

spec/spec_helper.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
SimpleCov.formatters = [
99
SimpleCov::Formatter::HTMLFormatter,
10-
SimpleCov::Formatter::Console
10+
SimpleCov::Formatter::Console,
1111
]
1212

1313
SimpleCov.start do

spec/unit/puppet/modulebuilder/builder_spec.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -231,15 +231,15 @@
231231
File.join('a' * 151, *['qwer'] * 19, 'bla'),
232232
File.join('/', 'a' * 49, 'b' * 50),
233233
File.join('a' * 49, "#{'b' * 50}x"),
234-
File.join("#{'a' * 49}x", 'b' * 50)
234+
File.join("#{'a' * 49}x", 'b' * 50),
235235
]
236236

237237
bad_paths = {
238238
File.join('a' * 152, 'b' * 11, 'c' * 93) => /longer than 256/i,
239239
File.join('a' * 152, 'b' * 10, 'c' * 92) => /could not be split/i,
240240
File.join('a' * 162, 'b' * 10) => /could not be split/i,
241241
File.join('a' * 10, 'b' * 110) => /could not be split/i,
242-
'a' * 114 => /could not be split/i
242+
'a' * 114 => /could not be split/i,
243243
}
244244

245245
good_paths.each do |path|
@@ -277,7 +277,7 @@
277277
let(:ignore_patterns) do
278278
[
279279
'/vendor/',
280-
'foo'
280+
'foo',
281281
]
282282
end
283283
let(:module_source) { File.join(root_dir, 'tmp', 'my-module') }
@@ -308,7 +308,7 @@
308308
[
309309
'.pdkignore',
310310
'.pmtignore',
311-
'.gitignore'
311+
'.gitignore',
312312
]
313313
end
314314
let(:available_files) { [] }

0 commit comments

Comments
 (0)