Skip to content

Commit 7275de4

Browse files
committed
Layout/SpaceBeforeSemicolon
This commit enables the Rubocop Layout/SpaceBeforeSemicolon cop and addresses all offenses.
1 parent 2c6855e commit 7275de4

File tree

11 files changed

+34
-45
lines changed

11 files changed

+34
-45
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,6 @@ I18n/GetText/DecorateStringFormattingUsingPercent:
2222
I18n/RailsI18n/DecorateString:
2323
Enabled: false
2424

25-
# This cop supports safe auto-correction (--auto-correct).
26-
Layout/SpaceBeforeSemicolon:
27-
Exclude:
28-
- 'lib/puppet/functions.rb'
29-
- 'lib/puppet/network/http/connection.rb'
30-
- 'lib/puppet/pops/model/model_label_provider.rb'
31-
- 'lib/puppet/pops/parser/slurp_support.rb'
32-
- 'lib/puppet/pops/types/class_loader.rb'
33-
- 'lib/puppet/pops/types/type_formatter.rb'
34-
- 'lib/puppet/settings/errors.rb'
35-
- 'lib/puppet/util/network_device/base.rb'
36-
- 'lib/puppet/util/windows.rb'
37-
- 'lib/puppet/util/windows/eventlog.rb'
38-
3925
# This cop supports safe auto-correction (--auto-correct).
4026
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets.
4127
# SupportedStyles: space, no_space, compact

lib/puppet/functions.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ def self.default_dispatcher(the_class, func_name)
281281
def self.min_max_param(method)
282282
result = {:req => 0, :opt => 0, :rest => 0 }
283283
# count per parameter kind, and get array of names
284-
names = method.parameters.map { |p| result[p[0]] += 1 ; p[1].to_s }
284+
names = method.parameters.map { |p| result[p[0]] += 1; p[1].to_s }
285285
from = result[:req]
286286
to = result[:rest] > 0 ? :default : from + result[:opt]
287287
[from, to, names]

lib/puppet/network/http/connection.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require_relative '../../../puppet/http'
44

55
# This will be raised if too many redirects happen for a given HTTP request
6-
class Puppet::Network::HTTP::RedirectionLimitExceededException < Puppet::Error ; end
6+
class Puppet::Network::HTTP::RedirectionLimitExceededException < Puppet::Error; end
77

88
# This class provides simple methods for issuing various types of HTTP
99
# requests. It's interface is intended to mirror Ruby's Net::HTTP

lib/puppet/pops/model/model_label_provider.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def label o
2020
@@label_visitor.visit_this_0(self, o)
2121
end
2222

23+
# rubocop:disable Layout/SpaceBeforeSemicolon
2324
def label_Factory o ; label(o.model) end
2425
def label_Array o ; "Array" end
2526
def label_LiteralInteger o ; "Literal Integer" end
@@ -105,6 +106,7 @@ def label_Timestamp o ; "Timestamp" en
105106
def label_Timespan o ; "Timespan" end
106107
def label_Version o ; "Semver" end
107108
def label_VersionRange o ; "SemverRange" end
109+
# rubocop:enable Layout/SpaceBeforeSemicolon
108110

109111
def label_PResourceType o
110112
if o.title

lib/puppet/pops/parser/slurp_support.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,14 @@ def slurp(scanner, pattern, escapes, ignore_invalid_escapes)
8686
ch = $1
8787
if escapes.include? ch
8888
case ch
89-
when 'r' ; "\r"
90-
when 'n' ; "\n"
91-
when 't' ; "\t"
92-
when 's' ; ' '
89+
when 'r'; "\r"
90+
when 'n'; "\n"
91+
when 't'; "\t"
92+
when 's'; ' '
9393
when 'u'
9494
lex_warning(Issues::ILLEGAL_UNICODE_ESCAPE)
9595
"\\u"
96-
when "\n" ; ''
96+
when "\n"; ''
9797
when "\r\n"; ''
9898
else ch
9999
end

lib/puppet/pops/types/class_loader.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def self.provide_from_type(type)
5656

5757
# Although not expected to be the first choice for getting a concrete class for these
5858
# types, these are of value if the calling logic just has a reference to type.
59-
#
59+
# rubocop:disable Layout/SpaceBeforeSemicolon
6060
when PArrayType ; Array
6161
when PTupleType ; Array
6262
when PHashType ; Hash
@@ -69,6 +69,7 @@ def self.provide_from_type(type)
6969
when PFloatType ; Float
7070
when PUndefType ; NilClass
7171
when PCallableType ; Proc
72+
# rubocop:enable Layout/SpaceBeforeSemicolon
7273
else
7374
nil
7475
end

lib/puppet/pops/types/type_formatter.rb

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -142,30 +142,30 @@ def debug_string(t)
142142
end
143143

144144
# @api private
145-
def string_PAnyType(_) ; @bld << 'Any' ; end
145+
def string_PAnyType(_); @bld << 'Any'; end
146146

147147
# @api private
148-
def string_PUndefType(_) ; @bld << 'Undef' ; end
148+
def string_PUndefType(_); @bld << 'Undef'; end
149149

150150
# @api private
151-
def string_PDefaultType(_) ; @bld << 'Default' ; end
151+
def string_PDefaultType(_); @bld << 'Default'; end
152152

153153
# @api private
154154
def string_PBooleanType(t)
155155
append_array('Boolean', t.value.nil?) { append_string(t.value) }
156156
end
157157

158158
# @api private
159-
def string_PScalarType(_) ; @bld << 'Scalar' ; end
159+
def string_PScalarType(_); @bld << 'Scalar'; end
160160

161161
# @api private
162-
def string_PScalarDataType(_) ; @bld << 'ScalarData' ; end
162+
def string_PScalarDataType(_); @bld << 'ScalarData'; end
163163

164164
# @api private
165-
def string_PNumericType(_) ; @bld << 'Numeric' ; end
165+
def string_PNumericType(_); @bld << 'Numeric'; end
166166

167167
# @api private
168-
def string_PBinaryType(_) ; @bld << 'Binary' ; end
168+
def string_PBinaryType(_); @bld << 'Binary'; end
169169

170170
# @api private
171171
def string_PIntegerType(t)
@@ -584,7 +584,7 @@ def string_Array(t)
584584
end
585585

586586
# @api private
587-
def string_FalseClass(t) ; @bld << 'false' ; end
587+
def string_FalseClass(t); @bld << 'false'; end
588588

589589
# @api private
590590
def string_Hash(t)
@@ -597,13 +597,13 @@ def string_Module(t)
597597
end
598598

599599
# @api private
600-
def string_NilClass(t) ; @bld << (@ruby ? 'nil' : 'undef') ; end
600+
def string_NilClass(t); @bld << (@ruby ? 'nil' : 'undef'); end
601601

602602
# @api private
603-
def string_Numeric(t) ; @bld << t.to_s ; end
603+
def string_Numeric(t); @bld << t.to_s; end
604604

605605
# @api private
606-
def string_Regexp(t) ; @bld << PRegexpType.regexp_to_s_with_delimiters(t); end
606+
def string_Regexp(t); @bld << PRegexpType.regexp_to_s_with_delimiters(t); end
607607

608608
# @api private
609609
def string_String(t)
@@ -612,22 +612,22 @@ def string_String(t)
612612
end
613613

614614
# @api private
615-
def string_Symbol(t) ; @bld << t.to_s ; end
615+
def string_Symbol(t); @bld << t.to_s; end
616616

617617
# @api private
618-
def string_TrueClass(t) ; @bld << 'true' ; end
618+
def string_TrueClass(t); @bld << 'true'; end
619619

620620
# @api private
621-
def string_Version(t) ; @bld << "'#{t}'" ; end
621+
def string_Version(t); @bld << "'#{t}'"; end
622622

623623
# @api private
624-
def string_VersionRange(t) ; @bld << "'#{t}'" ; end
624+
def string_VersionRange(t); @bld << "'#{t}'"; end
625625

626626
# @api private
627-
def string_Timespan(t) ; @bld << "'#{t}'" ; end
627+
def string_Timespan(t); @bld << "'#{t}'"; end
628628

629629
# @api private
630-
def string_Timestamp(t) ; @bld << "'#{t}'" ; end
630+
def string_Timestamp(t); @bld << "'#{t}'"; end
631631

632632
# Debugging to_s to reduce the amount of output
633633
def to_s

lib/puppet/settings/errors.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
require_relative '../../puppet/error'
55

66
class Puppet::Settings
7-
class SettingsError < Puppet::Error ; end
8-
class ValidationError < SettingsError ; end
9-
class InterpolationError < SettingsError ; end
7+
class SettingsError < Puppet::Error; end
8+
class ValidationError < SettingsError; end
9+
class InterpolationError < SettingsError; end
1010

1111
class ParseError < SettingsError
1212
include Puppet::ExternalFileError

lib/puppet/util/network_device/base.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def initialize(url, options = {})
1616
if @autoloader.load(@url.scheme, Puppet.lookup(:current_environment))
1717
@transport = Puppet::Util::NetworkDevice::Transport.const_get(@url.scheme.capitalize).new(options[:debug])
1818
@transport.host = @url.host
19-
@transport.port = @url.port || case @url.scheme ; when "ssh" ; 22 ; when "telnet" ; 23 ; end
19+
@transport.port = @url.port || case @url.scheme; when "ssh"; 22; when "telnet"; 23; end
2020
@transport.user = @url.user
2121
@transport.password = @url.password
2222
end

lib/puppet/util/windows.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class EventLog; end
3232
# Also, this does not modify the value of WIN32OLE.locale - which defaults
3333
# to 2048 (at least on US English Windows) and is not listed in the MS
3434
# locales table, here: https://msdn.microsoft.com/en-us/library/ms912047(v=winembedded.10).aspx
35-
require 'win32ole' ; WIN32OLE.codepage = WIN32OLE::CP_UTF8
35+
require 'win32ole'; WIN32OLE.codepage = WIN32OLE::CP_UTF8
3636

3737
# these reference platform specific gems
3838
require_relative '../../puppet/ffi/windows'

0 commit comments

Comments
 (0)