Skip to content

Commit 40332a3

Browse files
committed
(PUP-11993) Style/TrailingCommaInArrayLiteral
This commit enables the Style/TrailingCommaInArrayLiteral cop and fixes 16 autocorrectable offenses.
1 parent 937f2f2 commit 40332a3

File tree

15 files changed

+16
-36
lines changed

15 files changed

+16
-36
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -734,26 +734,6 @@ Style/SymbolArray:
734734
Style/TernaryParentheses:
735735
Enabled: false
736736

737-
# This cop supports safe auto-correction (--auto-correct).
738-
# Configuration parameters: EnforcedStyleForMultiline.
739-
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
740-
Style/TrailingCommaInArrayLiteral:
741-
Exclude:
742-
- 'ext/windows/service/daemon.rb'
743-
- 'lib/puppet/functions.rb'
744-
- 'lib/puppet/parser/compiler.rb'
745-
- 'lib/puppet/pops/types/p_uri_type.rb'
746-
- 'lib/puppet/pops/types/string_converter.rb'
747-
- 'lib/puppet/pops/types/types.rb'
748-
- 'lib/puppet/provider/package/windows/exe_package.rb'
749-
- 'lib/puppet/provider/service/upstart.rb'
750-
- 'lib/puppet/settings.rb'
751-
- 'lib/puppet/ssl/certificate_request.rb'
752-
- 'lib/puppet/ssl/oids.rb'
753-
- 'lib/puppet/transaction/persistence.rb'
754-
- 'lib/puppet/util/at_fork/solaris.rb'
755-
- 'lib/puppet/util/windows/registry.rb'
756-
757737
# This cop supports safe auto-correction (--auto-correct).
758738
# Configuration parameters: EnforcedStyleForMultiline.
759739
# SupportedStylesForMultiline: comma, consistent_comma, no_comma

ext/windows/service/daemon.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def load_env(base_dir)
197197
ENV['SSL_CERT_FILE'] = File.join(base_dir, 'puppet', 'ssl', 'cert.pem').tr('/', '\\')
198198
ENV['Path'] = [
199199
File.join(base_dir, 'puppet', 'bin'),
200-
File.join(base_dir, 'bin'),
200+
File.join(base_dir, 'bin')
201201
].join(';').tr('/', '\\') + ';' + ENV.fetch('Path', nil)
202202

203203
# ENV that uses forward slashes

lib/puppet/functions.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ class Function3x < InternalFunction
688688
['p0', 'p1'].freeze,
689689
['p0', 'p1', 'p2'].freeze,
690690
['p0', 'p1', 'p2', 'p3'].freeze,
691-
['p0', 'p1', 'p2', 'p3', 'p4'].freeze,
691+
['p0', 'p1', 'p2', 'p3', 'p4'].freeze
692692
]
693693

694694
# Creates an anonymous Function3x class that wraps a 3x function

lib/puppet/parser/compiler.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def self.compile(node, code_id = nil)
2828
errors.each { |e| Puppet.err(e) } if errors.size > 1
2929
errmsg = [
3030
_("Compilation has been halted because: %{error}") % { error: errors.first },
31-
_("For more information, see https://puppet.com/docs/puppet/latest/environments_about.html"),
31+
_("For more information, see https://puppet.com/docs/puppet/latest/environments_about.html")
3232
]
3333
raise(Puppet::Error, errmsg.join(' '))
3434
end

lib/puppet/pops/types/p_uri_type.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class PURIType < PAnyType
4646
TypeFactory.type_type(PPatternType::DEFAULT),
4747
TypeFactory.type_type(PEnumType::DEFAULT),
4848
TypeFactory.type_type(PNotUndefType::DEFAULT),
49-
TypeFactory.type_type(PUndefType::DEFAULT),
49+
TypeFactory.type_type(PUndefType::DEFAULT)
5050
]))
5151

5252
TYPE_INTEGER_PARAM =
@@ -55,7 +55,7 @@ class PURIType < PAnyType
5555
.new([
5656
PIntegerType.new(0),
5757
TypeFactory.type_type(PNotUndefType::DEFAULT),
58-
TypeFactory.type_type(PUndefType::DEFAULT),
58+
TypeFactory.type_type(PUndefType::DEFAULT)
5959
]))
6060

6161
TYPE_URI_PARAM_HASH_TYPE = TypeFactory.struct(

lib/puppet/pops/types/string_converter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class Format
8989

9090
FMT_PATTERN_STR = '^%([\s\[+#0{<(|-]*)([1-9][0-9]*)?(?:\.([0-9]+))?([a-zA-Z])$'
9191
FMT_PATTERN = Regexp.compile(FMT_PATTERN_STR)
92-
DELIMITERS = ['[', '{', '(', '<', '|',]
92+
DELIMITERS = ['[', '{', '(', '<', '|']
9393
DELIMITER_MAP = {
9494
'[' => ['[', ']'],
9595
'{' => ['{', '}'],

lib/puppet/pops/types/types.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def self.create_ptype(loader, ir, parent_name, attributes_hash = EMPTY_HASH)
5757
def self.register_ptypes(loader, ir)
5858
types = [
5959
Annotation.register_ptype(loader, ir),
60-
RubyMethod.register_ptype(loader, ir),
60+
RubyMethod.register_ptype(loader, ir)
6161
]
6262
Types.constants.each do |c|
6363
next if c == :PType || c == :PHostClassType

lib/puppet/provider/package/windows/exe_package.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class ExePackage < Puppet::Provider::Package::Windows::Package
1616
'Security Update',
1717
'Update Rollup',
1818
'Hotfix',
19-
'WindowsInstaller',
19+
'WindowsInstaller'
2020
]
2121

2222
def self.register(path)

lib/puppet/provider/service/upstart.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
Puppet.runtime[:facter].value('os.name') == 'Ubuntu',
1616
(Puppet.runtime[:facter].value('os.family') == 'RedHat' and Puppet.runtime[:facter].value('os.release.full') =~ /^6\./),
1717
(Puppet.runtime[:facter].value('os.name') == 'Amazon' and Puppet.runtime[:facter].value('os.release.major') =~ /\d{4}/),
18-
Puppet.runtime[:facter].value('os.name') == 'LinuxMint',
18+
Puppet.runtime[:facter].value('os.name') == 'LinuxMint'
1919
]
2020

2121
defaultfor 'os.name' => :ubuntu, 'os.release.major' => ["10.04", "12.04", "14.04", "14.10"]

lib/puppet/settings.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,7 @@ def reuse
852852
def configsearchpath(environment = nil, run_mode = preferred_run_mode)
853853
searchpath = [
854854
SearchPathElement.new(:memory, :values),
855-
SearchPathElement.new(:cli, :values),
855+
SearchPathElement.new(:cli, :values)
856856
]
857857
searchpath << SearchPathElement.new(environment.intern, :environment) if environment
858858

0 commit comments

Comments
 (0)