Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "(maint) Exclude breaking rubocop versions" #385

Merged
merged 3 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@

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'

Check warning on line 212 in lib/puppet-debugserver/debug_session/hook_handlers.rb

View check run for this annotation

Codecov / codecov/patch

lib/puppet-debugserver/debug_session/hook_handlers.rb#L212

Added line #L212 was not covered by tests

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 @@
# @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 Expand Up @@ -515,7 +512,7 @@
# @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}"

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

View check run for this annotation

Codecov / codecov/patch

lib/puppet-debugserver/puppet_debug_session.rb#L515

Added line #L515 was not covered by tests
@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 @@
end

def execute_job(job_object)
super(job_object)
super

Check warning on line 34 in lib/puppet-languageserver/global_queues/sidecar_queue.rb

View check run for this annotation

Codecov / codecov/patch

lib/puppet-languageserver/global_queues/sidecar_queue.rb#L34

Added line #L34 was not covered by tests
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 @@
end

def execute_job(job_object)
super(job_object)
super

Check warning on line 34 in lib/puppet-languageserver/global_queues/validation_queue.rb

View check run for this annotation

Codecov / codecov/patch

lib/puppet-languageserver/global_queues/validation_queue.rb#L34

Added line #L34 was not covered by tests
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 @@
end

def unhandled_exception(error, options)
super(error, options)
super

Check warning on line 391 in lib/puppet-languageserver/message_handler.rb

View check run for this annotation

Codecov / codecov/patch

lib/puppet-languageserver/message_handler.rb#L391

Added line #L391 was not covered by tests
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 @@
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 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 @@
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/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
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 @@
KEY_MESSAGE = 'message'

def initialize(connection)
super(connection)
super

Check warning on line 48 in lib/puppet_editor_services/protocol/json_rpc.rb

View check run for this annotation

Codecov / codecov/patch

lib/puppet_editor_services/protocol/json_rpc.rb#L48

Added line #L48 was not covered by tests

@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 from_h!(value)
value = {} if value.nil?
super(value)
super

Check warning on line 61 in lib/puppet_editor_services/protocol/json_rpc_messages.rb

View check run for this annotation

Codecov / codecov/patch

lib/puppet_editor_services/protocol/json_rpc_messages.rb#L61

Added line #L61 was not covered by tests
self.id = value['id']
self.rpc_method = value['method']
self.params = value['params']
Expand Down Expand Up @@ -94,7 +94,7 @@

def from_h!(value)
value = {} if value.nil?
super(value)
super

Check warning on line 97 in lib/puppet_editor_services/protocol/json_rpc_messages.rb

View check run for this annotation

Codecov / codecov/patch

lib/puppet_editor_services/protocol/json_rpc_messages.rb#L97

Added line #L97 was not covered by tests
self.rpc_method = value['method']
self.params = value['params']
self
Expand Down Expand Up @@ -136,7 +136,7 @@

def from_h!(value)
value = {} if value.nil?
super(value)
super

Check warning on line 139 in lib/puppet_editor_services/protocol/json_rpc_messages.rb

View check run for this annotation

Codecov / codecov/patch

lib/puppet_editor_services/protocol/json_rpc_messages.rb#L139

Added line #L139 was not covered by tests
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 @@
# @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] }

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

View check run for this annotation

Codecov / codecov/patch

lib/puppet_editor_services/server/tcp.rb#L143

Added line #L143 was not covered by tests
else
self.class.e_locker.synchronize { self.class.events << [handler, args] }
end
Expand Down Expand Up @@ -301,7 +301,7 @@
# @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
Loading