diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 822ccf62..205c4185 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,6 +14,7 @@ jobs: matrix: ruby_version: - '2.7' + - '3.2' runs_on: - 'ubuntu-latest' - 'windows-latest' @@ -32,6 +33,7 @@ jobs: matrix: ruby_version: - '2.7' + - '3.2' runs_on: - 'ubuntu-latest' - 'windows-latest' diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index b1cfe267..aaf2737d 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1 +1,61 @@ -# Empty \ No newline at end of file +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2023-09-25 11:18:05 UTC using RuboCop version 1.48.1. +# 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 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator. +# SupportedStylesForExponentOperator: space, no_space +Layout/SpaceAroundOperators: + Exclude: + - 'lib/puppet_editor_services/protocol/json_rpc.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyleForEmptyBraces. +# SupportedStyles: space, no_space, compact +# SupportedStylesForEmptyBraces: space, no_space +Layout/SpaceInsideHashLiteralBraces: + EnforcedStyle: space + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowInHeredoc. +Layout/TrailingWhitespace: + Exclude: + - 'lib/puppet-languageserver/puppetfile/validation_provider.rb' + +# Offense count: 17 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantBegin: + Exclude: + - 'lib/dsp/dsp.rb' + - 'lib/lsp/lsp.rb' + - 'lib/puppet-debugserver/hooks.rb' + - 'lib/puppet-languageserver/global_queues/single_instance_queue.rb' + - 'lib/puppet-languageserver/manifest/validation_provider.rb' + - 'lib/puppet-languageserver/providers.rb' + - 'lib/puppet-languageserver/puppet_monkey_patches.rb' + - 'lib/puppet_debugserver.rb' + - 'lib/puppet_editor_services/server/tcp.rb' + - 'lib/puppet_languageserver.rb' + - 'lib/puppet_languageserver_sidecar.rb' + +# Offense count: 2 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/SlicingWithRange: + Exclude: + - 'lib/puppet-languageserver/manifest/hover_provider.rb' + - 'lib/puppet-languageserver/puppet_lexer_helper.rb' + +# Offense count: 3 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/ZeroLengthPredicate: + Exclude: + - 'lib/puppet-debugserver/debug_session/hook_handlers.rb' + - 'lib/puppet-languageserver/message_handler.rb' + - 'lib/puppet_editor_services/server/tcp.rb' diff --git a/Gemfile b/Gemfile index 6ae97cd0..f475e3e4 100644 --- a/Gemfile +++ b/Gemfile @@ -15,9 +15,9 @@ group :development do gem 'puppetfile-resolver', '~> 0.6.2', :require => false gem 'yard', '~> 0.9.28', :require => false - gem "rubocop", '= 1.6.1', require: false - gem "rubocop-performance", '= 1.9.1', require: false - gem "rubocop-rspec", '= 2.0.1', require: false + gem "rubocop", '~> 1.48.1', require: false + gem "rubocop-performance", '~> 1.16', require: false + gem "rubocop-rspec", '~> 2.19', require: false if ENV['PUPPET_GEM_VERSION'] gem 'puppet', ENV['PUPPET_GEM_VERSION'], :require => false diff --git a/Rakefile b/Rakefile index 0e53cbf1..3d56d85a 100644 --- a/Rakefile +++ b/Rakefile @@ -65,7 +65,7 @@ task :gem_revendor do { :directory => 'puppetfile-resolver', :github_repo => 'https://github.com/glennsarti/puppetfile-resolver.git', - :github_ref => '0.3.0', + :github_ref => '0.6.2', }, { :directory => 'molinillo', diff --git a/lib/puppet-languageserver/puppetfile/validation_provider.rb b/lib/puppet-languageserver/puppetfile/validation_provider.rb index d6e8ef5e..0f460839 100644 --- a/lib/puppet-languageserver/puppetfile/validation_provider.rb +++ b/lib/puppet-languageserver/puppetfile/validation_provider.rb @@ -43,7 +43,6 @@ def self.validate(content, options = {}) puppetfile.validation_errors.each do |validation_error| related_information = nil - if validation_error.is_a?(PuppetfileResolver::Puppetfile::DocumentDuplicateModuleError) related_information = validation_error.duplicates.map do |dup_mod| { @@ -87,7 +86,7 @@ def self.validate_resolution(puppetfile_document, document_uri, cache, module_pa 'message' => e.message )] end - + resolution.validation_errors.map do |error| severity = case error when PuppetfileResolver::Puppetfile::DocumentLatestVersionError @@ -160,7 +159,6 @@ def self.document_error_to_diagnostic(document_uri, error) 'message' => "Module definition for #{dup_mod.name}" } end - LSP::Diagnostic.new( 'severity' => LSP::DiagnosticSeverity::ERROR, 'range' => document_location_to_lsp_range(error.puppetfile_modules[0].location), diff --git a/spec/languageserver/unit/puppet-languageserver/puppetfile/validation_provider_spec.rb b/spec/languageserver/unit/puppet-languageserver/puppetfile/validation_provider_spec.rb index f6068fbd..a7cf6e5e 100644 --- a/spec/languageserver/unit/puppet-languageserver/puppetfile/validation_provider_spec.rb +++ b/spec/languageserver/unit/puppet-languageserver/puppetfile/validation_provider_spec.rb @@ -88,6 +88,8 @@ def load(name) expect(lint_error.source).to eq('Puppet') expect(lint_error.message).to match('syntax error') expect(lint_error.range).to_not be_nil + expect(lint_error.range.start.line).to eq(12) + expect(lint_error.range.end.line).to eq(12) expect(lint_error.severity).to eq(LSP::DiagnosticSeverity::ERROR) end end @@ -108,6 +110,15 @@ def load(name) mod 'gittagmodule', :git => 'https://github.com/username/repo', :tag => '0.1' + + # Svn style modules + mod 'svnmodule', + :svn => 'svn://host/repo', + :rev => 'abc123' + + # local style modules + mod 'localmodule', + :local => 'true' EOT end @@ -146,7 +157,6 @@ def load(name) lint_error = subject.validate(content, validation_options) expect(lint_error.count).to eq(1) lint_error = lint_error[0] - expect(lint_error.source).to eq('Puppet') expect(lint_error.message).to match('A Mock Runtime Error') expect(lint_error.range.start.line).to eq(10) @@ -466,7 +476,7 @@ def load(name) :owner=>"puppetlabs", :start_line=>3, :title=>"puppetlabs-somemodule", - :version=>"1.0.0"}]) + :version=>"=1.0.0"}]) # this is now how versions are returned by puppetfile-resolver, see https://github.com/glennsarti/puppetfile-resolver/pull/16/files end end diff --git a/vendor/README.md b/vendor/README.md index a59dbf41..446da6ff 100644 --- a/vendor/README.md +++ b/vendor/README.md @@ -13,7 +13,7 @@ Gem List * puppet-lint (https://github.com/puppetlabs/puppet-lint.git ref v4.2.0) * hiera-eyaml (https://github.com/voxpupuli/hiera-eyaml ref v2.1.0) -* puppetfile-resolver (https://github.com/glennsarti/puppetfile-resolver.git ref 0.3.0) +* puppetfile-resolver (https://github.com/glennsarti/puppetfile-resolver.git ref 0.6.2) * molinillo (https://github.com/CocoaPods/Molinillo.git ref 0.6.6) * puppet-strings (https://github.com/puppetlabs/puppet-strings.git ref v4.1.0) * yard (https://github.com/lsegal/yard.git ref v0.9.24)