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

(CAT-1688) Upgrade rubocop to ~> 1.50.0 #367

Merged
merged 1 commit into from
Jan 24, 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
37 changes: 15 additions & 22 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2023-09-26 10:42:02 UTC using RuboCop version 1.48.1.
# on 2024-01-23 14:26:06 UTC using RuboCop version 1.50.2.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.




# Offense count: 1
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches.
Lint/DuplicateBranch:
Expand Down Expand Up @@ -38,6 +35,7 @@ Lint/NonAtomicFileOperation:
Lint/OrAssignmentToConstant:
Exclude:
- 'lib/puppet-languageserver/session_state/document_store.rb'

# Offense count: 169
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
Metrics/AbcSize:
Expand All @@ -59,7 +57,7 @@ Metrics/ClassLength:
Metrics/CyclomaticComplexity:
Max: 42

# Offense count: 139
# Offense count: 138
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Max: 100
Expand All @@ -74,7 +72,7 @@ Metrics/ModuleLength:
Metrics/ParameterLists:
Max: 6

# Offense count: 42
# Offense count: 43
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/PerceivedComplexity:
Max: 32
Expand All @@ -87,7 +85,6 @@ Naming/MemoizedInstanceVariableName:
- 'lib/puppet-languageserver-sidecar/puppet_strings_monkey_patches.rb'
- 'lib/puppet-languageserver/server_capabilities.rb'


# Offense count: 3
# Configuration parameters: MinSize.
Performance/CollectionLiteralInLoop:
Expand All @@ -100,24 +97,26 @@ Performance/Count:
Exclude:
- 'lib/puppet-languageserver/session_state/language_client.rb'



# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Security/IoMethods:
Exclude:
- 'lib/puppet-debugserver/debug_session/break_points.rb'


# Offense count: 5
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowedMethods, AllowedPatterns.
# AllowedMethods: ==, equal?, eql?
# Style/ClassEqualityComparison:
# Exclude:
# - 'lib/puppet-languageserver/manifest/definition_provider.rb'
# - 'lib/puppet-languageserver/manifest/signature_provider.rb'

# Offense count: 104
# Configuration parameters: AllowedConstants.
Style/Documentation:
Enabled: false




# Offense count: 4
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowedReceivers.
Expand All @@ -129,10 +128,6 @@ Style/HashEachMethods:
- 'lib/puppet-languageserver-sidecar/puppet_strings_helper.rb'
- 'lib/puppet-languageserver/manifest/folding_provider.rb'





# Offense count: 7
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
Expand Down Expand Up @@ -160,8 +155,7 @@ Style/OptionalBooleanParameter:
- 'lib/puppet-languageserver/uri_helper.rb'
- 'lib/puppet_editor_services/server/tcp.rb'


# Offense count: 34
# Offense count: 29
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
# AllowedMethods: present?, blank?, presence, try, try!
Expand Down Expand Up @@ -189,14 +183,13 @@ Style/SlicingWithRange:
- 'lib/puppet-languageserver/manifest/hover_provider.rb'
- 'lib/puppet-languageserver/puppet_lexer_helper.rb'

# Offense count: 6
# Offense count: 5
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments.
# AllowedMethods: define_method
Style/SymbolProc:
Exclude:
- 'lib/dsp/dsp_base.rb'
- 'lib/puppet-languageserver-sidecar/cache/filesystem.rb'
- 'lib/puppet-languageserver-sidecar/puppet_helper.rb'
- 'lib/puppet-languageserver/client_session_state.rb'
- 'lib/puppet-languageserver/session_state/object_cache.rb'
Expand All @@ -210,7 +203,7 @@ Style/ZeroLengthPredicate:
- 'lib/puppet-languageserver/message_handler.rb'
- 'lib/puppet_editor_services/server/tcp.rb'

# Offense count: 629
# Offense count: 622
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
# URISchemes: http, https
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ 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.48.1', :require => false
gem "rubocop", '~> 1.50.0', :require => false
gem "rubocop-performance", '~> 1.16', :require => false
gem "rubocop-rspec", '~> 2.19', :require => false
gem 'simplecov', :require => false
Expand Down
8 changes: 4 additions & 4 deletions lib/puppet-languageserver/manifest/definition_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
# class { 'testclass': <--- testclass would be the LiteralString inside a ResourceBody
# }
if !parent.nil? &&
parent.class.to_s == 'Puppet::Pops::Model::ResourceBody' &&
parent.instance_of?(::Puppet::Pops::Model::ResourceBody) &&

Check warning on line 33 in lib/puppet-languageserver/manifest/definition_provider.rb

View check run for this annotation

Codecov / codecov/patch

lib/puppet-languageserver/manifest/definition_provider.rb#L33

Added line #L33 was not covered by tests
parent.title.value == item.value
resource_name = item.value
response << type_or_class(session_state, resource_name)
Expand All @@ -42,18 +42,18 @@

# What if it's a function name. Then the Qualified name must be the same as the function name
if !parent.nil? &&
parent.class.to_s == 'Puppet::Pops::Model::CallNamedFunctionExpression' &&
parent.instance_of?(::Puppet::Pops::Model::CallNamedFunctionExpression) &&

Check warning on line 45 in lib/puppet-languageserver/manifest/definition_provider.rb

View check run for this annotation

Codecov / codecov/patch

lib/puppet-languageserver/manifest/definition_provider.rb#L45

Added line #L45 was not covered by tests
parent.functor_expr.value == item.value
func_name = item.value
response << function_name(session_state, func_name)
end
# What if it's an "include <class>" call
if !parent.nil? && parent.class.to_s == 'Puppet::Pops::Model::CallNamedFunctionExpression' && parent.functor_expr.value == 'include'
if !parent.nil? && parent.instance_of?(::Puppet::Pops::Model::CallNamedFunctionExpression) && parent.functor_expr.value == 'include'

Check warning on line 51 in lib/puppet-languageserver/manifest/definition_provider.rb

View check run for this annotation

Codecov / codecov/patch

lib/puppet-languageserver/manifest/definition_provider.rb#L51

Added line #L51 was not covered by tests
resource_name = item.value
response << type_or_class(session_state, resource_name)
end
# What if it's the name of a resource type or class
if !parent.nil? && parent.class.to_s == 'Puppet::Pops::Model::ResourceExpression'
if !parent.nil? && parent.instance_of?(::Puppet::Pops::Model::ResourceExpression)

Check warning on line 56 in lib/puppet-languageserver/manifest/definition_provider.rb

View check run for this annotation

Codecov / codecov/patch

lib/puppet-languageserver/manifest/definition_provider.rb#L56

Added line #L56 was not covered by tests
resource_name = item.value
response << type_or_class(session_state, resource_name)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet-languageserver/manifest/signature_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

function_ast_object = nil
# Try and find the acutal function object within the AST
if item.class.to_s == 'Puppet::Pops::Model::CallNamedFunctionExpression'
if item.instance_of?(::Puppet::Pops::Model::CallNamedFunctionExpression)

Check warning on line 25 in lib/puppet-languageserver/manifest/signature_provider.rb

View check run for this annotation

Codecov / codecov/patch

lib/puppet-languageserver/manifest/signature_provider.rb#L25

Added line #L25 was not covered by tests
function_ast_object = item
else
# Try and find the function with the AST tree
Expand Down
Loading