Skip to content

Commit

Permalink
Correct rubocop warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Gavin Didrichsen <[email protected]>
  • Loading branch information
gavindidrichsen committed Jun 20, 2024
1 parent e35ab80 commit 6ff69ff
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
7 changes: 2 additions & 5 deletions lib/puppet-debugserver/puppet_debug_session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -431,12 +431,9 @@ def line_for_offset(obj, offset)
# @return [Array<DSP::Variable>] Array of DSP::Variable
# @private
def variable_list_from_hash(obj_hash = {})
result = []
obj_hash.sort.each do |key, value|
result << variable_from_ruby_object(key, value)
obj_hash.sort.map do |key, value|
variable_from_ruby_object(key, value)

Check warning on line 435 in lib/puppet-debugserver/puppet_debug_session.rb

View check run for this annotation

Codecov / codecov/patch

lib/puppet-debugserver/puppet_debug_session.rb#L434-L435

Added lines #L434 - L435 were not covered by tests
end

result
end

# Converts an array of ruby objects into an array of DSP::Variable objects
Expand Down
6 changes: 3 additions & 3 deletions lib/puppet-languageserver/session_state/object_cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def objects_by_section(section, &_block)
return if section.nil?

@cache_lock.synchronize do
@inmemory_cache.each do |_, sections|
@inmemory_cache.each_value do |sections|

Check warning on line 131 in lib/puppet-languageserver/session_state/object_cache.rb

View check run for this annotation

Codecov / codecov/patch

lib/puppet-languageserver/session_state/object_cache.rb#L131

Added line #L131 was not covered by tests
next if sections.nil? || sections[section].nil? || sections[section].empty?

sections[section].each { |i| yield i.key, i }
Expand All @@ -138,10 +138,10 @@ def objects_by_section(section, &_block)

def all_objects(&_block)
@cache_lock.synchronize do
@inmemory_cache.each do |_origin, sections|
@inmemory_cache.each_value do |sections|

Check warning on line 141 in lib/puppet-languageserver/session_state/object_cache.rb

View check run for this annotation

Codecov / codecov/patch

lib/puppet-languageserver/session_state/object_cache.rb#L141

Added line #L141 was not covered by tests
next if sections.nil?

sections.each do |_section_name, list|
sections.each_value do |list|

Check warning on line 144 in lib/puppet-languageserver/session_state/object_cache.rb

View check run for this annotation

Codecov / codecov/patch

lib/puppet-languageserver/session_state/object_cache.rb#L144

Added line #L144 was not covered by tests
list.each { |i| yield i.key, i }
end
end
Expand Down
13 changes: 6 additions & 7 deletions lib/puppet-languageserver/sidecar_protocol.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,12 @@ def eql?(other)
end

def hash
props = []
self.class
.instance_methods(false)
.reject { |name| name.to_s.end_with?('=', '!') }
.reject { |name| %i[to_h to_json].include?(name) }
.each do |method_name|
props << send(method_name).hash
props = self.class
.instance_methods(false)
.reject { |name| name.to_s.end_with?('=', '!') }
.reject { |name| %i[to_h to_json].include?(name) }
.map do |method_name|
send(method_name).hash

Check warning on line 75 in lib/puppet-languageserver/sidecar_protocol.rb

View check run for this annotation

Codecov / codecov/patch

lib/puppet-languageserver/sidecar_protocol.rb#L70-L75

Added lines #L70 - L75 were not covered by tests
end
props.hash
end
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet_editor_services/server/tcp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def add_connection(io, service_object)
# @api public
def connection(connection_id)
self.class.c_locker.synchronize do
self.class.io_connection_dic.each do |_, v|
self.class.io_connection_dic.each_value do |v|

Check warning on line 304 in lib/puppet_editor_services/server/tcp.rb

View check run for this annotation

Codecov / codecov/patch

lib/puppet_editor_services/server/tcp.rb#L304

Added line #L304 was not covered by tests
return v[:handler] unless v[:handler].nil? || v[:handler].id != connection_id
end
end
Expand Down

0 comments on commit 6ff69ff

Please sign in to comment.