Skip to content

Commit

Permalink
Merge pull request #385 from puppetlabs/revert-380-maint_exclude_rubo…
Browse files Browse the repository at this point in the history
…cop_versions

Revert "(maint) Exclude breaking rubocop versions"
  • Loading branch information
david22swan authored Jun 20, 2024
2 parents ac89014 + b65b51c commit 497f214
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 34 deletions.
6 changes: 2 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ group :development do
gem 'puppet-lint', '~> 4.0', :require => false
gem 'puppetfile-resolver', '~> 0.6.2', :require => false
gem 'yard', '~> 0.9.28', :require => false
gem "rubocop", '~> 1.50.0', :require => false
gem "rubocop", '~> 1.64.0', :require => false
gem "rubocop-performance", '~> 1.16', :require => false
gem "rubocop-rspec", '~> 2.19', :require => false
gem 'rubocop-factory_bot', '!= 2.26.0', require: false
gem 'rubocop-rspec_rails', '!= 2.29.0', require: false
gem "rubocop-rspec", '~> 3.0', :require => false
gem 'simplecov', :require => false
gem 'simplecov-console', :require => false

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet-debugserver/debug_session/hook_handlers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def on_hook_log_message(args)

msg = args[0]
str = msg.respond_to?(:multiline) ? msg.multiline : msg.to_s
str = msg.source == 'Puppet' ? str : "#{msg.source}: #{str}"
str = "#{msg.source}: #{str}" unless msg.source == 'Puppet'

level = msg.level.to_s.capitalize

Expand Down
9 changes: 3 additions & 6 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)
end

result
end

# Converts an array of ruby objects into an array of DSP::Variable objects
Expand Down Expand Up @@ -515,7 +512,7 @@ class LogMessageAggregator
# @param hook_manager [PuppetDebugServer::Hooks] The hook manager to use
def initialize(hook_manager)
@hook_manager = hook_manager
@hook_id = "aggregator#{object_id}".intern
@hook_id = :"aggregator#{object_id}"
@messages = []
@started = false
end
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet-languageserver/global_queues/sidecar_queue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def job_class
end

def execute_job(job_object)
super(job_object)
super
connection = connection_from_connection_id(job_object.connection_id)
raise "Connection is not available for connection id #{job_object.connection_id}" if connection.nil?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def job_class
end

def execute_job(job_object)
super(job_object)
super
session_state = session_state_from_connection_id(job_object.connection_id)
document_store = session_state.nil? ? nil : session_state.documents
raise "Document store is not available for connection id #{job_object.connection_id}" unless document_store
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet-languageserver/message_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ def response_workspace_configuration(_, json_rpc_message, original_request)
end

def unhandled_exception(error, options)
super(error, options)
super
PuppetLanguageServer::CrashDump.write_crash_file(error, session_state, nil, options)
end

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|
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|
next if sections.nil?

sections.each do |_section_name, list|
sections.each_value do |list|
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
end
props.hash
end
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet_editor_services/protocol/debug_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class DebugAdapter < ::PuppetEditorServices::Protocol::Base
KEY_TYPE = 'type'

def initialize(connection)
super(connection)
super

@state = :data
@buffer = []
Expand Down
6 changes: 3 additions & 3 deletions lib/puppet_editor_services/protocol/debug_adapter_messages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def initialize(initial_hash = nil)

def from_h!(value)
value = {} if value.nil?
super(value)
super
self.command = value['command']
self.arguments = value['arguments']
self
Expand Down Expand Up @@ -84,7 +84,7 @@ def initialize(initial_hash = nil)

def from_h!(value)
value = {} if value.nil?
super(value)
super
self.event = value['event']
self.body = value['body']
self
Expand Down Expand Up @@ -121,7 +121,7 @@ def initialize(initial_hash = nil)

def from_h!(value)
value = {} if value.nil?
super(value)
super
self.request_seq = value['request_seq']
self.success = value['success']
self.command = value['command']
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet_editor_services/protocol/json_rpc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class JsonRPC < ::PuppetEditorServices::Protocol::Base
KEY_MESSAGE = 'message'

def initialize(connection)
super(connection)
super

@state = :data
@buffer = []
Expand Down
6 changes: 3 additions & 3 deletions lib/puppet_editor_services/protocol/json_rpc_messages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def initialize(initial_hash = nil)

def from_h!(value)
value = {} if value.nil?
super(value)
super
self.id = value['id']
self.rpc_method = value['method']
self.params = value['params']
Expand Down Expand Up @@ -94,7 +94,7 @@ def initialize(initial_hash = nil)

def from_h!(value)
value = {} if value.nil?
super(value)
super
self.rpc_method = value['method']
self.params = value['params']
self
Expand Down Expand Up @@ -136,7 +136,7 @@ def initialize(initial_hash = nil)

def from_h!(value)
value = {} if value.nil?
super(value)
super
self.id = value['id']
self.result = value['result']
self.error = value['error']
Expand Down
4 changes: 2 additions & 2 deletions lib/puppet_editor_services/server/tcp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def events?
# @api private
def push_event(handler, *args, &block)
if block
self.class.e_locker.synchronize { self.class.events << [(proc { |a| push_event block, handler.call(*a) }), args] }
self.class.e_locker.synchronize { self.class.events << [proc { |a| push_event block, handler.call(*a) }, args] }
else
self.class.e_locker.synchronize { self.class.events << [handler, args] }
end
Expand Down 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|
return v[:handler] unless v[:handler].nil? || v[:handler].id != connection_id
end
end
Expand Down

0 comments on commit 497f214

Please sign in to comment.