pronto-dialyzer 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -4
- data/lib/pronto/dialyzer.rb +31 -13
- data/lib/pronto/dialyzer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a26f118ce3d5d50d47feec9aa47f5fe127892fd6
|
4
|
+
data.tar.gz: 56e0cf6be31059b77cb0c5b7d65b131eb99ffa89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3a12f301614e1c058f34d2cdfc82f1bd108d6748d73ea1a36ff87a78bd4fe9dbb63509feb0cd4c4aa062a745515eede59c5bd059ce1ebbce3f60007971a4074
|
7
|
+
data.tar.gz: 992bb88a6dbe86f6c0e0ac09edc1975e1175f0ef8fc0aa17c6632aab78015df3949aa77c4d1920ba19d6f343909328c2b35ceb2a83c56844f6e83e54dd8cadc8
|
data/README.md
CHANGED
@@ -1,17 +1,31 @@
|
|
1
1
|
# Pronto runner for Dialyzer
|
2
2
|
|
3
|
-
This allows you to take the output of Dialyzer and submit its errors with
|
3
|
+
This allows you to take the output of Dialyzer and submit its errors with
|
4
|
+
[Pronto]. It works both with Elixir and Erlang.
|
4
5
|
|
5
6
|
## Installation
|
6
7
|
|
7
|
-
As an Elixir application will probably not have a Gemfile
|
8
|
+
As an Elixir/Erlang application will probably not have a `Gemfile`, install it with:
|
8
9
|
|
9
10
|
$ gem install pronto-dialyzer
|
10
11
|
|
12
|
+
After the gem is installed, [Pronto] will already be detected the Dialyzer
|
13
|
+
runner.
|
14
|
+
|
11
15
|
## Usage
|
12
16
|
|
13
|
-
It
|
14
|
-
|
17
|
+
It's important to enable the `-fullpath` option in your Dialyzer configuration
|
18
|
+
and send the output to a file with `-o`.
|
19
|
+
|
20
|
+
The path for Dialyzer's output file should then be passed to the runner. It uses
|
21
|
+
the environment variable `PRONTO_DIALYZER_OUTPUT` to define the location of
|
22
|
+
Dialyzer's output file. If this variable is not defined, it will look for the
|
23
|
+
file `dialyzer.out`.
|
24
|
+
|
25
|
+
### Running on Travis CI
|
26
|
+
|
27
|
+
Pronto works perfectly to create comment on PRs and commits. For that, use
|
28
|
+
`pronto run` as described in the readme for [Pronto].
|
15
29
|
|
16
30
|
## Contributing
|
17
31
|
|
@@ -21,3 +35,6 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/iurifq
|
|
21
35
|
## License
|
22
36
|
|
23
37
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
38
|
+
|
39
|
+
|
40
|
+
[Pronto]: https://github.com/mmozuras/pronto
|
data/lib/pronto/dialyzer.rb
CHANGED
@@ -3,10 +3,11 @@ require 'pronto'
|
|
3
3
|
|
4
4
|
module Pronto::Dialyzer
|
5
5
|
class Runner < Pronto::Runner
|
6
|
+
BEAM_EXTENSIONS = %w(.ex .erl).freeze
|
6
7
|
|
7
8
|
def run
|
8
|
-
return [] unless
|
9
|
-
|
9
|
+
return [] unless dialyzer_output_pathname.exist?
|
10
|
+
beam_patches
|
10
11
|
.select { |patch| patch.delta.status != :deleted }
|
11
12
|
.flat_map { |patch| affected_lines(patch) }
|
12
13
|
end
|
@@ -14,8 +15,9 @@ module Pronto::Dialyzer
|
|
14
15
|
def affected_lines(patch)
|
15
16
|
candidate_lines = patch.lines.select { |line| line.addition? }
|
16
17
|
candidate_lines.reduce([]) do |accum, line|
|
17
|
-
affected_line =
|
18
|
-
patch.repo.path.join(dline.path) == patch.new_file_full_path &&
|
18
|
+
affected_line = dialyzer_lines.find do |dline|
|
19
|
+
patch.repo.path.join(dline.path) == patch.new_file_full_path &&
|
20
|
+
dline.lineno == line.new_lineno
|
19
21
|
end
|
20
22
|
|
21
23
|
if affected_line
|
@@ -30,19 +32,35 @@ module Pronto::Dialyzer
|
|
30
32
|
Pronto::Message.new(dline.path, line, :warning, dline.error)
|
31
33
|
end
|
32
34
|
|
33
|
-
def
|
34
|
-
@patches.select
|
35
|
+
def beam_patches
|
36
|
+
@patches.select do |patch|
|
37
|
+
BEAM_EXTENSIONS.member?(File.extname(patch.new_file_full_path))
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def dialyzer_output_pathname
|
42
|
+
@dialyzer_output_path ||= Pathname.new(
|
43
|
+
ENV["PRONTO_DIALYZER_OUTPUT"] || "dialyzer.out"
|
44
|
+
)
|
35
45
|
end
|
36
46
|
|
37
|
-
def
|
38
|
-
|
47
|
+
def dialyzer_lines
|
48
|
+
@dialyzer_lines ||= matching_lines(
|
49
|
+
dialyzer_output_pathname,
|
50
|
+
/(?<path>.+\.[a-z]{2,3}):(?<lineno>[0-9]+): (?<error_msg>.+)/
|
51
|
+
)
|
39
52
|
end
|
40
53
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
54
|
+
private
|
55
|
+
|
56
|
+
def matching_lines(pathname, line_regex)
|
57
|
+
pathname.readlines.reduce([]) do |accum, line|
|
58
|
+
if match = line.match(line_regex)
|
59
|
+
accum << OpenStruct.new(
|
60
|
+
path: match[:path],
|
61
|
+
lineno: match[:lineno].to_i,
|
62
|
+
error: match[:error_msg]
|
63
|
+
)
|
46
64
|
else
|
47
65
|
accum
|
48
66
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pronto-dialyzer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Iuri Fernandes
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pronto
|