solargraph-reek 0.1.0 → 0.1.1

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: 2f6c87c50f06ccbdfc22e313b5c988f9217aa7392a3701d4f12625980df3f54e
4
- data.tar.gz: 88e533dedfbd09c8252f58265fae064e5ac9659a9c45b1cf333e271c7ec87b42
3
+ metadata.gz: f45fcb15b2ee755fdb94c4afd8a71cdc522d5feb9fbc5267835501a739fe4bba
4
+ data.tar.gz: 88d4b4ef2a83d465f0476fdd62a3d631abab85bab5cbae06b9c7427ae54b89bc
5
5
  SHA512:
6
- metadata.gz: affc79a7a5fa0d2840ba8ec4e2f89df98ace5f4d39c5bcbb9e43c40bb56e63bdbef28e529c5b471cbd9a563e1c1e45a72a85fa9d260f96477a8cdce2b48df1fe
7
- data.tar.gz: 5a35eb9c158a173348ab4ce7300508cc9b18c5086737106d9e42ac44c8308a715b6fb62c6c0b3b05f832316dd5c62bc97ca80d2def1c22e3c024168ebfa30072
6
+ metadata.gz: 8203374d992c26c1e62f14f6c243bb09486db2a8803e74a338b6a8f3564971d834ac056e316e6408d6de616a96c6372e5dc5dc614473f2de6a6b34e208c47c1a
7
+ data.tar.gz: bd6b362bdca099f67d6a54e954f875b950068c0ef842dbb580f8ae0e1d19165239e45f6bd996837d4abc4e157d247f0dbd8e409e907aea42d906d061f5d05f73
data/CHANGELOG.md ADDED
@@ -0,0 +1,4 @@
1
+ ## 0.1.1 - December 9, 2022
2
+ - Load configuration from .reek.yml (#1)
3
+ - Fix directory directives (#2)
4
+ - Full support for Reek configuration files (#3)
@@ -1,5 +1,5 @@
1
- module Solargraph
2
- module Reek
3
- VERSION = "0.1.0"
4
- end
5
- end
1
+ module Solargraph
2
+ module Reek
3
+ VERSION = "0.1.1"
4
+ end
5
+ end
@@ -1,31 +1,37 @@
1
- require 'solargraph'
2
- require 'solargraph-reek/version'
3
- require 'reek'
4
-
5
- module Solargraph
6
- module Reek
7
- class Reporter < Solargraph::Diagnostics::Base
8
- def diagnose source, _api_map
9
- examiner = ::Reek::Examiner.new(source.code.dup)
10
- examiner.smells.map { |w| warning_to_diagnostic(w) }
11
- rescue ::Reek::Errors::SyntaxError
12
- []
13
- end
14
-
15
- private
16
-
17
- # @param warning [::Reek::SmellWarning]
18
- # @return [Hash]
19
- def warning_to_diagnostic(warning)
20
- {
21
- range: Solargraph::Range.from_to(warning.lines.first - 1, 0, warning.lines.last, 0).to_hash,
22
- severity: Diagnostics::Severities::WARNING,
23
- source: 'Reek',
24
- message: "[#{warning.smell_type}] #{warning.message}"
25
- }
26
- end
27
- end
28
- end
29
- end
30
-
31
- Solargraph::Diagnostics.register 'reek', Solargraph::Reek::Reporter
1
+ require 'solargraph'
2
+ require 'solargraph-reek/version'
3
+ require 'reek'
4
+ require 'pathname'
5
+
6
+ module Solargraph
7
+ module Reek
8
+ class Reporter < Solargraph::Diagnostics::Base
9
+ def diagnose(source, _api_map)
10
+ configuration = ::Reek::Configuration::AppConfiguration.from_default_path
11
+ source_pathname = Pathname.new(source.filename)
12
+
13
+ return [] if configuration.path_excluded?(source_pathname)
14
+
15
+ examiner = ::Reek::Examiner.new(source_pathname, configuration: configuration)
16
+ examiner.smells.map { |w| warning_to_diagnostic(w) }
17
+ rescue ::Reek::Errors::SyntaxError
18
+ []
19
+ end
20
+
21
+ private
22
+
23
+ # @param warning [::Reek::SmellWarning]
24
+ # @return [Hash]
25
+ def warning_to_diagnostic(warning)
26
+ {
27
+ range: Solargraph::Range.from_to(warning.lines.first - 1, 0, warning.lines.last, 0).to_hash,
28
+ severity: Diagnostics::Severities::WARNING,
29
+ source: 'Reek',
30
+ message: "[#{warning.smell_type}] #{warning.message}"
31
+ }
32
+ end
33
+ end
34
+ end
35
+ end
36
+
37
+ Solargraph::Diagnostics.register 'reek', Solargraph::Reek::Reporter
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solargraph-reek
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Snyder
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-26 00:00:00.000000000 Z
11
+ date: 2022-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: reek
@@ -80,7 +80,7 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '3.0'
83
- description:
83
+ description:
84
84
  email:
85
85
  - fsnyder@castwide.com
86
86
  executables: []
@@ -90,6 +90,7 @@ files:
90
90
  - ".gitignore"
91
91
  - ".rspec"
92
92
  - ".travis.yml"
93
+ - CHANGELOG.md
93
94
  - Gemfile
94
95
  - LICENSE.txt
95
96
  - README.md
@@ -103,7 +104,7 @@ homepage: https://solargraph.org
103
104
  licenses:
104
105
  - MIT
105
106
  metadata: {}
106
- post_install_message:
107
+ post_install_message:
107
108
  rdoc_options: []
108
109
  require_paths:
109
110
  - lib
@@ -118,8 +119,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
119
  - !ruby/object:Gem::Version
119
120
  version: '0'
120
121
  requirements: []
121
- rubygems_version: 3.1.2
122
- signing_key:
122
+ rubygems_version: 3.3.7
123
+ signing_key:
123
124
  specification_version: 4
124
125
  summary: A Reek diagnostics reporter for Solargraph
125
126
  test_files: []