danger-findbugs 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardoc/checksums +5 -0
- data/.yardoc/complete +0 -0
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/Gemfile.lock +2 -2
- data/README.md +55 -13
- data/lib/findbugs/gem_version.rb +1 -1
- data/lib/findbugs/plugin.rb +56 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3046d0b60cb2518acd1e4661142a429b09448266
|
4
|
+
data.tar.gz: 558294bdc689242e984cb9257d72d9dd501f6fc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 348ba4ae2228a9fe308d54767fa2009450a235d0ef0fcbcb129e7b9004006dd28a02f4e6847a4906ad82312b65ebbacf29c1556a9e4470d09935d5c3bf2af4ec
|
7
|
+
data.tar.gz: cb3887f5cec26254ac4eb1e2972b2cae0c4e4012c168c18ad93a1330364db1bb4ff86c63efecdb7ed3d8076d91a692b85e6f159873c8972d5cf705300cb83202
|
data/.yardoc/checksums
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
/Users/kazukiyoshida/.ghq/github.com/kazy1991/danger-findbugs/lib/danger_findbugs.rb ed1b710ccaba0d5083ec06a8a878b7845803f9fe
|
2
|
+
/Users/kazukiyoshida/.ghq/github.com/kazy1991/danger-findbugs/lib/danger_plugin.rb d17a1cd87e3957d27aeb0555be3444bb8a0b5b80
|
3
|
+
/Users/kazukiyoshida/.ghq/github.com/kazy1991/danger-findbugs/lib/findbugs/bug_issue.rb 4027ab9de6bf6007069aaf5796c7a1659f0ac9fe
|
4
|
+
/Users/kazukiyoshida/.ghq/github.com/kazy1991/danger-findbugs/lib/findbugs/gem_version.rb f922cd210d6ae8001390f0b9ca965826dc376f22
|
5
|
+
/Users/kazukiyoshida/.ghq/github.com/kazy1991/danger-findbugs/lib/findbugs/plugin.rb 2d3abb832db8419fb067b35db47c07e773b0f7de
|
data/.yardoc/complete
ADDED
File without changes
|
Binary file
|
Binary file
|
data/.yardoc/proxy_types
ADDED
Binary file
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
danger-findbugs (0.0.
|
4
|
+
danger-findbugs (0.0.3)
|
5
5
|
danger-plugin-api (~> 1.0)
|
6
6
|
oga (~> 2.10)
|
7
7
|
|
@@ -21,7 +21,7 @@ GEM
|
|
21
21
|
colored2 (3.1.2)
|
22
22
|
cork (0.3.0)
|
23
23
|
colored2 (~> 3.1)
|
24
|
-
danger (5.2.
|
24
|
+
danger (5.2.1)
|
25
25
|
claide (~> 1.0)
|
26
26
|
claide-plugins (>= 0.9.2)
|
27
27
|
colored2 (~> 3.1)
|
data/README.md
CHANGED
@@ -1,20 +1,62 @@
|
|
1
|
-
# danger-findbugs
|
2
1
|
|
3
|
-
A description of danger-findbugs.
|
4
2
|
|
5
|
-
|
3
|
+
### findbugs
|
6
4
|
|
7
|
-
|
5
|
+
Checks on your gradle project's Java source files.
|
6
|
+
This is done using [finbugs](http://findbugs.sourceforge.net/)
|
7
|
+
Results are passed out as tables in markdown.
|
8
|
+
|
9
|
+
<blockquote>Running Findbugs with its basic configuration
|
10
|
+
<pre>
|
11
|
+
findbugs.report</pre>
|
12
|
+
</blockquote>
|
13
|
+
|
14
|
+
<blockquote>Running Findbugs with a specific gradle task or report_file
|
15
|
+
<pre>
|
16
|
+
findbugs.gradle_task = "app:findbugs" #defalut: findbugs
|
17
|
+
findbugs.report_file = "app/build/reports/findbugs/findbugs.xml"
|
18
|
+
findbugs.report</pre>
|
19
|
+
</blockquote>
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
#### Attributes
|
24
|
+
|
25
|
+
`gradle_module` - Custom gradle module to run.
|
26
|
+
This is useful when your project has different flavors.
|
27
|
+
Defaults to "app".
|
28
|
+
|
29
|
+
`gradle_task` - Custom gradle task to run.
|
30
|
+
This is useful when your project has different flavors.
|
31
|
+
Defaults to "findbugs".
|
32
|
+
|
33
|
+
`report_file` - Location of report file
|
34
|
+
If your findbugs task outputs to a different location, you can specify it here.
|
35
|
+
Defaults to "build/reports/findbugs_report.xml".
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
#### Methods
|
41
|
+
|
42
|
+
`report` - Calls findbugs task of your gradle project.
|
43
|
+
It fails if `gradlew` cannot be found inside current directory.
|
44
|
+
It fails if `report_file` cannot be found inside current directory.
|
45
|
+
|
46
|
+
`target_files` - A getter for current updated files
|
47
|
+
|
48
|
+
`exec_gradle_task` - Run gradle task
|
49
|
+
|
50
|
+
`gradlew_exists?` - Check gradlew file exists in current directory
|
51
|
+
|
52
|
+
`report_file_exist?` - Check report_file exists in current directory
|
53
|
+
|
54
|
+
`findbugs_report` - A getter for `gradle_task`, returning "findbugs" if value is nil.
|
55
|
+
|
56
|
+
`bug_issues` - A getter for `gradle_task`, returning "findbugs" if value is nil.
|
57
|
+
|
58
|
+
`send_inline_comment` - Send inline comment with danger's warn or fail method
|
8
59
|
|
9
|
-
## Usage
|
10
60
|
|
11
|
-
Methods and attributes from this plugin are available in
|
12
|
-
your `Dangerfile` under the `findbugs` namespace.
|
13
61
|
|
14
|
-
## Development
|
15
62
|
|
16
|
-
1. Clone this repo
|
17
|
-
2. Run `bundle install` to setup dependencies.
|
18
|
-
3. Run `bundle exec rake spec` to run the tests.
|
19
|
-
4. Use `bundle exec guard` to automatically have tests run as you make changes.
|
20
|
-
5. Make your changes.
|
data/lib/findbugs/gem_version.rb
CHANGED
data/lib/findbugs/plugin.rb
CHANGED
@@ -1,15 +1,48 @@
|
|
1
1
|
module Danger
|
2
|
+
# Checks on your gradle project's Java source files.
|
3
|
+
# This is done using [finbugs](http://findbugs.sourceforge.net/)
|
4
|
+
# Results are passed out as tables in markdown.
|
5
|
+
#
|
6
|
+
# @example Running Findbugs with its basic configuration
|
7
|
+
#
|
8
|
+
# findbugs.report
|
9
|
+
#
|
10
|
+
# @example Running Findbugs with a specific gradle task or report_file
|
11
|
+
#
|
12
|
+
# findbugs.gradle_task = "app:findbugs" #defalut: findbugs
|
13
|
+
# findbugs.report_file = "app/build/reports/findbugs/findbugs.xml"
|
14
|
+
# findbugs.report
|
15
|
+
#
|
16
|
+
# @see kazy1991/danger-findbugs
|
17
|
+
# @tags android, findbugs
|
18
|
+
|
2
19
|
class DangerFindbugs < Plugin
|
3
|
-
require 'oga'
|
4
20
|
require_relative './bug_issue'
|
5
21
|
|
22
|
+
# Custom gradle module to run.
|
23
|
+
# This is useful when your project has different flavors.
|
24
|
+
# Defaults to "app".
|
25
|
+
# @return [String]
|
6
26
|
attr_writer :gradle_module
|
27
|
+
# Custom gradle task to run.
|
28
|
+
# This is useful when your project has different flavors.
|
29
|
+
# Defaults to "findbugs".
|
30
|
+
# @return [String]
|
7
31
|
attr_writer :gradle_task
|
32
|
+
# Location of report file
|
33
|
+
# If your findbugs task outputs to a different location, you can specify it here.
|
34
|
+
# Defaults to "build/reports/findbugs_report.xml".
|
35
|
+
# @return [String]
|
8
36
|
attr_writer :report_file
|
9
37
|
|
10
38
|
GRADLEW_NOT_FOUND = "Could not find `gradlew` inside current directory"
|
11
39
|
REPORT_FILE_NOT_FOUND = "Findbugs report not found"
|
12
40
|
|
41
|
+
# Calls findbugs task of your gradle project.
|
42
|
+
# It fails if `gradlew` cannot be found inside current directory.
|
43
|
+
# It fails if `report_file` cannot be found inside current directory.
|
44
|
+
# @return [void]
|
45
|
+
#
|
13
46
|
def report
|
14
47
|
return fail(GRADLEW_NOT_FOUND) unless gradlew_exists?
|
15
48
|
exec_gradle_task
|
@@ -17,44 +50,66 @@ module Danger
|
|
17
50
|
send_inline_comment
|
18
51
|
end
|
19
52
|
|
53
|
+
# A getter for `gradle_module`, returning "app" if value is nil.
|
54
|
+
# @return [String]
|
20
55
|
def gradle_module
|
21
56
|
@gradle_module ||= 'app'
|
22
57
|
end
|
23
58
|
|
59
|
+
# A getter for `gradle_task`, returning "findbugs" if value is nil.
|
60
|
+
# @return [String]
|
24
61
|
def gradle_task
|
25
62
|
@gradle_task ||= 'findbugs'
|
26
63
|
end
|
27
64
|
|
65
|
+
# A getter for `report_file`, returning "build/reports/findbugs_report.xml" if value is nil.
|
66
|
+
# @return [String]
|
28
67
|
def report_file
|
29
68
|
@report_file ||= 'build/reports/findbugs_report.xml'
|
30
69
|
end
|
31
70
|
|
71
|
+
# A getter for current updated files
|
72
|
+
# @return [Array[String]]
|
32
73
|
def target_files
|
33
74
|
@target_files ||= (git.modified_files - git.deleted_files) + git.added_files
|
34
75
|
end
|
35
76
|
|
77
|
+
# Run gradle task
|
78
|
+
# @return [void]
|
36
79
|
def exec_gradle_task
|
37
80
|
system "./gradlew #{gradle_task}"
|
38
81
|
end
|
39
82
|
|
83
|
+
# Check gradlew file exists in current directory
|
84
|
+
# @return [Bool]
|
40
85
|
def gradlew_exists?
|
41
86
|
`ls gradlew`.strip.empty? == false
|
42
87
|
end
|
43
88
|
|
89
|
+
# Check report_file exists in current directory
|
90
|
+
# @return [Bool]
|
44
91
|
def report_file_exist?
|
45
92
|
File.exists?(report_file)
|
46
93
|
end
|
47
94
|
|
95
|
+
# A getter for `gradle_task`, returning "findbugs" if value is nil.
|
96
|
+
# @return [Oga::XML::Document]
|
48
97
|
def findbugs_report
|
98
|
+
require 'oga'
|
49
99
|
@findbugs_report ||= Oga.parse_xml(File.open(report_file))
|
50
100
|
end
|
51
101
|
|
102
|
+
# A getter for `gradle_task`, returning "findbugs" if value is nil.
|
103
|
+
# @return [Array[BugIssue]]
|
52
104
|
def bug_issues
|
53
105
|
@bug_issues ||= findbugs_report.xpath("//BugInstance").map do |buginfo|
|
54
106
|
BugIssue.new(gradle_module, buginfo)
|
55
107
|
end
|
56
108
|
end
|
57
109
|
|
110
|
+
# Send inline comment with danger's warn or fail method
|
111
|
+
#
|
112
|
+
# @return [void]
|
58
113
|
def send_inline_comment
|
59
114
|
bug_issues.each do |issue|
|
60
115
|
next unless target_files.include? issue.absolute_path
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger-findbugs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kazuki-yoshida
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-plugin-api
|
@@ -173,6 +173,11 @@ extra_rdoc_files: []
|
|
173
173
|
files:
|
174
174
|
- ".gitignore"
|
175
175
|
- ".travis.yml"
|
176
|
+
- ".yardoc/checksums"
|
177
|
+
- ".yardoc/complete"
|
178
|
+
- ".yardoc/object_types"
|
179
|
+
- ".yardoc/objects/root.dat"
|
180
|
+
- ".yardoc/proxy_types"
|
176
181
|
- Gemfile
|
177
182
|
- Gemfile.lock
|
178
183
|
- Guardfile
|