Skip to content

Commit 6e5348f

Browse files
committed
Merge pull request #252 from mynameisrufus/rubocop-fix/space-inside-brackets
fix space inside brackets
2 parents 0573342 + 0e68084 commit 6e5348f

File tree

7 files changed

+17
-28
lines changed

7 files changed

+17
-28
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -571,17 +571,6 @@ Style/SpaceBeforeBlockBraces:
571571
Style/SpaceInsideBlockBraces:
572572
Enabled: false
573573

574-
# Offense count: 37
575-
# Cop supports --auto-correct.
576-
Style/SpaceInsideBrackets:
577-
Exclude:
578-
- 'lib/net/ber.rb'
579-
- 'lib/net/ldap.rb'
580-
- 'lib/net/ldap/connection.rb'
581-
- 'lib/net/ldap/filter.rb'
582-
- 'test/test_ldap_connection.rb'
583-
- 'testserver/ldapserver.rb'
584-
585574
# Offense count: 1
586575
# Cop supports --auto-correct.
587576
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.

lib/net/ber.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def self.compile_syntax(syntax)
235235
# TODO 20100327 AZ: Should we be allocating an array of 256 values
236236
# that will either be +nil+ or an object type symbol, or should we
237237
# allocate an empty Hash since unknown values return +nil+ anyway?
238-
out = [ nil ] * 256
238+
out = [nil] * 256
239239
syntax.each do |tag_class_id, encodings|
240240
tag_class = TAG_CLASS[tag_class_id]
241241
encodings.each do |encoding_id, classes|

lib/net/ldap.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,14 +264,14 @@ class Net::LDAP
264264
SearchScope_BaseObject = 0
265265
SearchScope_SingleLevel = 1
266266
SearchScope_WholeSubtree = 2
267-
SearchScopes = [ SearchScope_BaseObject, SearchScope_SingleLevel,
268-
SearchScope_WholeSubtree ]
267+
SearchScopes = [SearchScope_BaseObject, SearchScope_SingleLevel,
268+
SearchScope_WholeSubtree]
269269

270270
DerefAliases_Never = 0
271271
DerefAliases_Search = 1
272272
DerefAliases_Find = 2
273273
DerefAliases_Always = 3
274-
DerefAliasesArray = [ DerefAliases_Never, DerefAliases_Search, DerefAliases_Find, DerefAliases_Always ]
274+
DerefAliasesArray = [DerefAliases_Never, DerefAliases_Search, DerefAliases_Find, DerefAliases_Always]
275275

276276
primitive = { 2 => :null } # UnbindRequest body
277277
constructed = {

lib/net/ldap/connection.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -513,9 +513,9 @@ def self.modify_ops(operations)
513513
# TODO, fix the following line, which gives a bogus error if the
514514
# opcode is invalid.
515515
op_ber = MODIFY_OPERATIONS[op.to_sym].to_ber_enumerated
516-
values = [ values ].flatten.map { |v| v.to_ber if v }.to_ber_set
517-
values = [ attrib.to_s.to_ber, values ].to_ber_sequence
518-
ops << [ op_ber, values ].to_ber
516+
values = [values].flatten.map { |v| v.to_ber if v }.to_ber_set
517+
values = [attrib.to_s.to_ber, values].to_ber_sequence
518+
ops << [op_ber, values].to_ber
519519
end
520520
end
521521
ops
@@ -604,7 +604,7 @@ def add(args)
604604
add_dn = args[:dn] or raise Net::LDAP::EmptyDNError, "Unable to add empty DN"
605605
add_attrs = []
606606
a = args[:attributes] and a.each do |k, v|
607-
add_attrs << [ k.to_s.to_ber, Array(v).map { |m| m.to_ber}.to_ber_set ].to_ber_sequence
607+
add_attrs << [k.to_s.to_ber, Array(v).map { |m| m.to_ber}.to_ber_set].to_ber_sequence
608608
end
609609

610610
message_id = next_msgid

lib/net/ldap/filter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
class Net::LDAP::Filter
2424
##
2525
# Known filter types.
26-
FilterTypes = [ :ne, :eq, :ge, :le, :and, :or, :not, :ex, :bineq ]
26+
FilterTypes = [:ne, :eq, :ge, :le, :and, :or, :not, :ex, :bineq]
2727

2828
def initialize(op, left, right) #:nodoc:
2929
unless FilterTypes.include?(op)

test/test_ldap_connection.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,23 +112,23 @@ def test_raises_unknown_exceptions
112112
end
113113

114114
def test_modify_ops_delete
115-
args = { :operations => [ [ :delete, "mail" ] ] }
115+
args = { :operations => [[:delete, "mail"]] }
116116
result = Net::LDAP::Connection.modify_ops(args[:operations])
117-
expected = [ "0\r\n\x01\x010\b\x04\x04mail1\x00" ]
117+
expected = ["0\r\n\x01\x010\b\x04\x04mail1\x00"]
118118
assert_equal(expected, result)
119119
end
120120

121121
def test_modify_ops_add
122-
args = { :operations => [ [ :add, "mail", "testuser@example.com" ] ] }
122+
args = { :operations => [[:add, "mail", "testuser@example.com"]] }
123123
result = Net::LDAP::Connection.modify_ops(args[:operations])
124-
expected = [ "0#\n\x01\x000\x1E\x04\x04mail1\x16\x04\x14testuser@example.com" ]
124+
expected = ["0#\n\x01\x000\x1E\x04\x04mail1\x16\x04\x14testuser@example.com"]
125125
assert_equal(expected, result)
126126
end
127127

128128
def test_modify_ops_replace
129-
args = { :operations =>[ [ :replace, "mail", "testuser@example.com" ] ] }
129+
args = { :operations =>[[:replace, "mail", "testuser@example.com"]] }
130130
result = Net::LDAP::Connection.modify_ops(args[:operations])
131-
expected = [ "0#\n\x01\x020\x1E\x04\x04mail1\x16\x04\x14testuser@example.com" ]
131+
expected = ["0#\n\x01\x020\x1E\x04\x04mail1\x16\x04\x14testuser@example.com"]
132132
assert_equal(expected, result)
133133
end
134134

@@ -463,7 +463,7 @@ def test_search_net_ldap_connection_event
463463
# search data
464464
search_data_ber = Net::BER::BerIdentifiedArray.new([1, [
465465
"uid=user1,ou=People,dc=rubyldap,dc=com",
466-
[ ["uid", ["user1"]] ]
466+
[["uid", ["user1"]]]
467467
]])
468468
search_data_ber.ber_identifier = Net::LDAP::PDU::SearchReturnedData
469469
search_data = [1, search_data_ber]

testserver/ldapserver.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def handle_search_request pdu
156156

157157

158158
def send_ldap_response pkt_tag, msgid, code, dn, text
159-
send_data( [msgid.to_ber, [code.to_ber, dn.to_ber, text.to_ber].to_ber_appsequence(pkt_tag) ].to_ber )
159+
send_data( [msgid.to_ber, [code.to_ber, dn.to_ber, text.to_ber].to_ber_appsequence(pkt_tag)].to_ber )
160160
end
161161

162162
end

0 commit comments

Comments
 (0)