Skip to content

Commit 28f946b

Browse files
Merge pull request puppetlabs#94 from bastelfreak/rubocop
rubocop: Fix layout&style cops
2 parents e3c0a6e + 0b42f0f commit 28f946b

File tree

6 files changed

+17
-82
lines changed

6 files changed

+17
-82
lines changed

Diff for: .rubocop_todo.yml

+1-64
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,11 @@
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
77
# versions of RuboCop, may require this file to be generated again.
88

9-
# Offense count: 2
10-
# This cop supports safe autocorrection (--autocorrect).
11-
Layout/EmptyLines:
12-
Exclude:
13-
- 'Gemfile'
14-
- 'Rakefile'
15-
16-
# Offense count: 1
17-
# This cop supports safe autocorrection (--autocorrect).
18-
# Configuration parameters: Width, AllowedPatterns.
19-
Layout/IndentationWidth:
20-
Exclude:
21-
- 'Rakefile'
22-
239
# Offense count: 1
2410
Lint/MixedRegexpCaptureTypes:
2511
Exclude:
@@ -77,55 +63,6 @@ Style/FetchEnvVar:
7763
Exclude:
7864
- 'Gemfile'
7965

80-
# Offense count: 1
81-
# This cop supports safe autocorrection (--autocorrect).
82-
# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
83-
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
84-
# SupportedShorthandSyntax: always, never, either, consistent, either_consistent
85-
Style/HashSyntax:
86-
Exclude:
87-
- 'Gemfile'
88-
89-
# Offense count: 2
90-
# This cop supports safe autocorrection (--autocorrect).
91-
Style/RedundantRegexpEscape:
92-
Exclude:
93-
- 'Gemfile'
94-
95-
# Offense count: 1
96-
# This cop supports safe autocorrection (--autocorrect).
97-
# Configuration parameters: EnforcedStyle, AllowInnerSlashes.
98-
# SupportedStyles: slashes, percent_r, mixed
99-
Style/RegexpLiteral:
100-
Exclude:
101-
- 'Gemfile'
102-
103-
# Offense count: 1
104-
# This cop supports safe autocorrection (--autocorrect).
105-
# Configuration parameters: MinSize.
106-
# SupportedStyles: percent, brackets
107-
Style/SymbolArray:
108-
EnforcedStyle: brackets
109-
110-
# Offense count: 7
111-
# This cop supports safe autocorrection (--autocorrect).
112-
# Configuration parameters: EnforcedStyleForMultiline.
113-
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
114-
Style/TrailingCommaInArrayLiteral:
115-
Exclude:
116-
- 'lib/puppet/modulebuilder/builder.rb'
117-
- 'spec/spec_helper.rb'
118-
- 'spec/unit/puppet/modulebuilder/builder_spec.rb'
119-
120-
# Offense count: 3
121-
# This cop supports safe autocorrection (--autocorrect).
122-
# Configuration parameters: EnforcedStyleForMultiline.
123-
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
124-
Style/TrailingCommaInHashLiteral:
125-
Exclude:
126-
- 'lib/puppet/modulebuilder/builder.rb'
127-
- 'spec/unit/puppet/modulebuilder/builder_spec.rb'
128-
12966
# Offense count: 9
13067
# This cop supports safe autocorrection (--autocorrect).
13168
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.

Diff for: Gemfile

+3-4
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
@@ -27,7 +27,6 @@ group :development do
2727
gem 'simplecov'
2828
gem 'simplecov-console'
2929

30-
3130
# Required for testing on Windows
32-
gem 'ffi', :platforms => [:x64_mingw]
31+
gem 'ffi', platforms: [:x64_mingw]
3332
end

Diff for: Rakefile

+3-4
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,16 @@ end
1010
namespace :spec do
1111
desc 'Run RSpec code examples with coverage collection'
1212
task :coverage do
13-
ENV['COVERAGE'] = 'yes'
14-
Rake::Task['spec'].execute
13+
ENV['COVERAGE'] = 'yes'
14+
Rake::Task['spec'].execute
1515
end
1616
end
1717

18-
1918
RSpec::Core::RakeTask.new(:acceptance) do |t|
2019
t.pattern = 'spec/acceptance/**/*_spec.rb'
2120
end
2221

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

2524
begin
2625
require 'voxpupuli/rubocop/rake'

Diff for: 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

Diff for: 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

Diff for: 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)