ruby-lsp-reek 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8dc0f0d5264c4cb55e08c39e863d49113fc206876b594c37f1c5b495a04c18fc
4
- data.tar.gz: a5cacca4c13f0008b4ef9868ee9a4c557e296a0f64ebf9ac8951ad3771fe9875
3
+ metadata.gz: 2a825d18e3f5825299c0d0e6af7682e3a1f8aa2bc2a030a96a807eaa12aced63
4
+ data.tar.gz: c001a2068adb09a8c9610130da10d4ce9bdbb4e534c587b28a13ba53ad1fe42b
5
5
  SHA512:
6
- metadata.gz: 725b73500121ff791293945ff1fc6a26508abc50d77715a127966fd0de73071fbd51f667643579f5499249cbdfc1f787d8495621b9d56e1e44037fbd1bd045f4
7
- data.tar.gz: 595b0d95becf70e30584691601dec34d3a84aab1c390cbeed5ae4ff50c8060d96d0d0e0be62e8ef530ed0088c75341212e951e708e4fac41a5a58fe3ebc7e8b2
6
+ metadata.gz: 0cec537f3c7d5d39842c75a6715b54ae39999784bedc3b331b2f98effc248847b4a8daf534e193ae055a68b0aeef3b3f5af17b5aae7610510bb095b578dfbf3f
7
+ data.tar.gz: 3b8f36ccfc2455b2af3c6bb548c67b95e1ce95a72f98ed55138ec5efebf237fe2d2453822f09eef1bb902490794f2e6dcc1efb67fa793f083dea65e725ac5040
data/README.md CHANGED
@@ -14,10 +14,9 @@ And then execute:
14
14
 
15
15
  $ bundle
16
16
 
17
- Note: `ruby-lsp` does not seem to recognize this addon when installed outside
18
- of bundler, but YMMV:
19
-
20
- $ gem install ruby-lsp-reek
17
+ Note: Using globally installed linters in Ruby LSP is [not
18
+ supported](https://github.com/Shopify/ruby-lsp/blob/main/vscode/README.md#formatting),
19
+ they must in your Gemfile or gemspec.
21
20
 
22
21
  ## Usage
23
22
 
@@ -68,7 +68,7 @@ module RubyLsp
68
68
  def workspace_did_change_watched_files(changes)
69
69
  return unless changes.any? { |change| change[:uri].end_with?(".reek.yml") }
70
70
 
71
- runner.init!
71
+ @runner = Runner.new
72
72
  warn "Re-initialized Reek Ruby LSP addon v#{::RubyLsp::Reek::VERSION} due to .reek.yml file change"
73
73
  end
74
74
 
@@ -24,9 +24,10 @@ module RubyLsp
24
24
  # @param uri [String] The URI of the document to run diagnostics on.
25
25
  # @param document [RubyLsp::Interface::TextDocumentItem] The document to run diagnostics on.
26
26
  def run_diagnostic(uri, document)
27
- return [] if config.path_excluded?(Pathname.new(uri.path))
27
+ path = Pathname.new(uri.path)
28
+ return [] if path_excluded?(path)
28
29
 
29
- examiner = ::Reek::Examiner.new(document.source, configuration: config)
30
+ examiner = ::Reek::Examiner.new(path, configuration: config)
30
31
  examiner.smells.map { |smell| warning_to_diagnostic(smell) }
31
32
  end
32
33
 
@@ -56,6 +57,14 @@ module RubyLsp
56
57
  message: warning.message
57
58
  )
58
59
  end
60
+
61
+ def path_excluded?(path)
62
+ path.ascend do |ascendant|
63
+ break true if config.path_excluded?(ascendant)
64
+
65
+ false
66
+ end
67
+ end
59
68
  end
60
69
  end
61
70
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RubyLsp
4
4
  module Reek
5
- VERSION = "0.2.0"
5
+ VERSION = "0.3.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-lsp-reek
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Iain Gray
@@ -194,5 +194,5 @@ requirements: []
194
194
  rubygems_version: 3.5.11
195
195
  signing_key:
196
196
  specification_version: 4
197
- summary: Ruby LSP Reek
197
+ summary: Reek addon for Ruby-LSP
198
198
  test_files: []