danger-findbugs 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0a8d9f0ff4526c7f9d7e059c60e15b6c938a228d
4
+ data.tar.gz: 06b0ef43128a70089d079906861ff9c9ef18893e
5
+ SHA512:
6
+ metadata.gz: ae5bcde35f29e80a9db2df21917a753934e4b97d239d9ed1e42845fd7e3e0b04235e5ee99368f11caacf01a06fd7eb2fb507f49031fd7a4f88156d35c06dbd9b
7
+ data.tar.gz: dd8d48b757617c0c0f71e1ed20c0f1a7082fd150cbd85d1f52a6ecae8db4fc152d789b72ee3550c5616d44732bedf5a3cb02cd739ee786670eac624ce8c2d28b
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ .DS_Store
2
+ pkg
3
+ .idea/
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+ cache:
3
+ directories:
4
+ - bundle
5
+
6
+ rvm:
7
+ - 2.0
8
+ - 2.1.3
9
+ - 2.3.1
10
+
11
+ script:
12
+ - bundle exec rake spec
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in danger-findbugs.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,141 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ danger-findbugs (0.0.1)
5
+ danger-plugin-api (~> 1.0)
6
+ oga (~> 2.10)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ addressable (2.5.1)
12
+ public_suffix (~> 2.0, >= 2.0.2)
13
+ ansi (1.5.0)
14
+ ast (2.3.0)
15
+ claide (1.0.1)
16
+ claide-plugins (0.9.2)
17
+ cork
18
+ nap
19
+ open4 (~> 1.3)
20
+ coderay (1.1.1)
21
+ colored2 (3.1.2)
22
+ cork (0.3.0)
23
+ colored2 (~> 3.1)
24
+ danger (5.2.0)
25
+ claide (~> 1.0)
26
+ claide-plugins (>= 0.9.2)
27
+ colored2 (~> 3.1)
28
+ cork (~> 0.1)
29
+ faraday (~> 0.9)
30
+ faraday-http-cache (~> 1.0)
31
+ git (~> 1)
32
+ kramdown (~> 1.5)
33
+ octokit (~> 4.2)
34
+ terminal-table (~> 1)
35
+ danger-plugin-api (1.0.0)
36
+ danger (> 2.0)
37
+ diff-lcs (1.3)
38
+ faraday (0.12.1)
39
+ multipart-post (>= 1.2, < 3)
40
+ faraday-http-cache (1.3.1)
41
+ faraday (~> 0.8)
42
+ ffi (1.9.18)
43
+ formatador (0.2.5)
44
+ git (1.3.0)
45
+ guard (2.14.1)
46
+ formatador (>= 0.2.4)
47
+ listen (>= 2.7, < 4.0)
48
+ lumberjack (~> 1.0)
49
+ nenv (~> 0.1)
50
+ notiffany (~> 0.0)
51
+ pry (>= 0.9.12)
52
+ shellany (~> 0.0)
53
+ thor (>= 0.18.1)
54
+ guard-compat (1.2.1)
55
+ guard-rspec (4.7.3)
56
+ guard (~> 2.1)
57
+ guard-compat (~> 1.1)
58
+ rspec (>= 2.99.0, < 4.0)
59
+ kramdown (1.13.2)
60
+ listen (3.0.7)
61
+ rb-fsevent (>= 0.9.3)
62
+ rb-inotify (>= 0.9.7)
63
+ lumberjack (1.0.11)
64
+ method_source (0.8.2)
65
+ multipart-post (2.0.0)
66
+ nap (1.1.0)
67
+ nenv (0.3.0)
68
+ notiffany (0.1.1)
69
+ nenv (~> 0.1)
70
+ shellany (~> 0.0)
71
+ octokit (4.7.0)
72
+ sawyer (~> 0.8.0, >= 0.5.3)
73
+ oga (2.10)
74
+ ast
75
+ ruby-ll (~> 2.1)
76
+ open4 (1.3.4)
77
+ parser (2.4.0.0)
78
+ ast (~> 2.2)
79
+ powerpack (0.1.1)
80
+ pry (0.10.4)
81
+ coderay (~> 1.1.0)
82
+ method_source (~> 0.8.1)
83
+ slop (~> 3.4)
84
+ public_suffix (2.0.5)
85
+ rainbow (2.2.2)
86
+ rake
87
+ rake (10.5.0)
88
+ rb-fsevent (0.9.8)
89
+ rb-inotify (0.9.8)
90
+ ffi (>= 0.5.0)
91
+ rspec (3.6.0)
92
+ rspec-core (~> 3.6.0)
93
+ rspec-expectations (~> 3.6.0)
94
+ rspec-mocks (~> 3.6.0)
95
+ rspec-core (3.6.0)
96
+ rspec-support (~> 3.6.0)
97
+ rspec-expectations (3.6.0)
98
+ diff-lcs (>= 1.2.0, < 2.0)
99
+ rspec-support (~> 3.6.0)
100
+ rspec-mocks (3.6.0)
101
+ diff-lcs (>= 1.2.0, < 2.0)
102
+ rspec-support (~> 3.6.0)
103
+ rspec-support (3.6.0)
104
+ rubocop (0.48.1)
105
+ parser (>= 2.3.3.1, < 3.0)
106
+ powerpack (~> 0.1)
107
+ rainbow (>= 1.99.1, < 3.0)
108
+ ruby-progressbar (~> 1.7)
109
+ unicode-display_width (~> 1.0, >= 1.0.1)
110
+ ruby-ll (2.1.2)
111
+ ansi
112
+ ast
113
+ ruby-progressbar (1.8.1)
114
+ sawyer (0.8.1)
115
+ addressable (>= 2.3.5, < 2.6)
116
+ faraday (~> 0.8, < 1.0)
117
+ shellany (0.0.1)
118
+ slop (3.6.0)
119
+ terminal-table (1.7.3)
120
+ unicode-display_width (~> 1.1.1)
121
+ thor (0.19.4)
122
+ unicode-display_width (1.1.3)
123
+ yard (0.9.9)
124
+
125
+ PLATFORMS
126
+ ruby
127
+
128
+ DEPENDENCIES
129
+ bundler (~> 1.3)
130
+ danger-findbugs!
131
+ guard (~> 2.14)
132
+ guard-rspec (~> 4.7)
133
+ listen (= 3.0.7)
134
+ pry
135
+ rake (~> 10.0)
136
+ rspec (~> 3.4)
137
+ rubocop (~> 0.41)
138
+ yard (~> 0.8)
139
+
140
+ BUNDLED WITH
141
+ 1.14.6
data/Guardfile ADDED
@@ -0,0 +1,19 @@
1
+ # A guardfile for making Danger Plugins
2
+ # For more info see https://github.com/guard/guard#readme
3
+
4
+ # To run, use `bundle exec guard`.
5
+
6
+ guard :rspec, cmd: 'bundle exec rspec' do
7
+ require 'guard/rspec/dsl'
8
+ dsl = Guard::RSpec::Dsl.new(self)
9
+
10
+ # RSpec files
11
+ rspec = dsl.rspec
12
+ watch(rspec.spec_helper) { rspec.spec_dir }
13
+ watch(rspec.spec_support) { rspec.spec_dir }
14
+ watch(rspec.spec_files)
15
+
16
+ # Ruby files
17
+ ruby = dsl.ruby
18
+ dsl.watch_spec_files_for(ruby.lib_files)
19
+ end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 Kazuki Yoshida
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2017 kazuki-yoshida <kzk.yshd@gmail.com>
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,20 @@
1
+ # danger-findbugs
2
+
3
+ A description of danger-findbugs.
4
+
5
+ ## Installation
6
+
7
+ $ gem install danger-findbugs
8
+
9
+ ## Usage
10
+
11
+ Methods and attributes from this plugin are available in
12
+ your `Dangerfile` under the `findbugs` namespace.
13
+
14
+ ## Development
15
+
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/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+ require 'rubocop/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new(:specs)
6
+
7
+ task default: :specs
8
+
9
+ task :spec do
10
+ Rake::Task['specs'].invoke
11
+ Rake::Task['rubocop'].invoke
12
+ Rake::Task['spec_docs'].invoke
13
+ end
14
+
15
+ desc 'Run RuboCop on the lib/specs directory'
16
+ RuboCop::RakeTask.new(:rubocop) do |task|
17
+ task.patterns = ['lib/**/*.rb', 'spec/**/*.rb']
18
+ end
19
+
20
+ desc 'Ensure that the plugin passes `danger plugins lint`'
21
+ task :spec_docs do
22
+ sh 'bundle exec danger plugins lint'
23
+ end
@@ -0,0 +1,50 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'findbugs/gem_version.rb'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'danger-findbugs'
8
+ spec.version = Findbugs::VERSION
9
+ spec.authors = ['kazuki-yoshida']
10
+ spec.email = ['kzk.yshd@gmail.com']
11
+ spec.description = %q{A short description of danger-findbugs.}
12
+ spec.summary = %q{A longer description of danger-findbugs.}
13
+ spec.homepage = 'https://github.com/kazuki-yoshida/danger-findbugs'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_runtime_dependency 'danger-plugin-api', '~> 1.0'
22
+ spec.add_runtime_dependency 'oga', '~> 2.10'
23
+
24
+ # General ruby development
25
+ spec.add_development_dependency 'bundler', '~> 1.3'
26
+ spec.add_development_dependency 'rake', '~> 10.0'
27
+
28
+ # Testing support
29
+ spec.add_development_dependency 'rspec', '~> 3.4'
30
+
31
+ # Linting code and docs
32
+ spec.add_development_dependency "rubocop", "~> 0.41"
33
+ spec.add_development_dependency "yard", "~> 0.8"
34
+
35
+ # Makes testing easy via `bundle exec guard`
36
+ spec.add_development_dependency 'guard', '~> 2.14'
37
+ spec.add_development_dependency 'guard-rspec', '~> 4.7'
38
+
39
+ # If you want to work on older builds of ruby
40
+ spec.add_development_dependency 'listen', '3.0.7'
41
+
42
+ # This gives you the chance to run a REPL inside your tests
43
+ # via:
44
+ #
45
+ # require 'pry'
46
+ # binding.pry
47
+ #
48
+ # This will stop test execution and let you inspect the results
49
+ spec.add_development_dependency 'pry'
50
+ end
@@ -0,0 +1 @@
1
+ require 'findbugs/gem_version'
@@ -0,0 +1 @@
1
+ require 'findbugs/plugin'
@@ -0,0 +1,35 @@
1
+ class BugIssue
2
+ RANK_ERROR_THRESHOLD = 4
3
+ attr_accessor :module_name
4
+ attr_accessor :buginfo
5
+
6
+ def initialize(module_name, buginfo)
7
+ @module_name = module_name
8
+ @buginfo = buginfo
9
+ end
10
+
11
+ def rank
12
+ @rack ||= buginfo.attribute("rank").value.to_i
13
+ end
14
+
15
+ def type
16
+ @type ||= rank > RANK_ERROR_THRESHOLD ? :warning : :error
17
+ end
18
+
19
+ def line
20
+ @line ||= buginfo.xpath("SourceLine/@start").first.to_s.to_i
21
+ end
22
+
23
+ def source_path
24
+ @source_path ||= buginfo.xpath("SourceLine/@sourcepath").first.to_s
25
+ end
26
+
27
+ def description
28
+ @description ||= buginfo.xpath("LongMessage/text()").first.text
29
+ end
30
+
31
+ def absolute_path
32
+ @absolute_path ||= Pathname.new(module_name).join("src/main/java", source_path).to_s
33
+ end
34
+
35
+ end
@@ -0,0 +1,3 @@
1
+ module Findbugs
2
+ VERSION = "0.0.1".freeze
3
+ end
@@ -0,0 +1,65 @@
1
+ module Danger
2
+ class DangerFindbugs < Plugin
3
+ require 'oga'
4
+ require_relative './bug_issue'
5
+
6
+ attr_writer :gradle_module
7
+ attr_writer :gradle_task
8
+ attr_writer :report_file
9
+
10
+ GRADLEW_NOT_FOUND = "Could not find `gradlew` inside current directory"
11
+ REPORT_FILE_NOT_FOUND = "Findbugs report not found"
12
+
13
+ def report
14
+ return fail(GRADLEW_NOT_FOUND) unless gradlew_exists?
15
+ exec_gradle_task
16
+ return fail(REPORT_FILE_NOT_FOUND) unless report_file_exist?
17
+ send_inline_comment
18
+ end
19
+
20
+ def gradle_module
21
+ @gradle_module ||= 'app'
22
+ end
23
+
24
+ def gradle_task
25
+ @gradle_task ||= 'findbugs'
26
+ end
27
+
28
+ def report_file
29
+ @report_file ||= 'build/reports/findbugs_report.xml'
30
+ end
31
+
32
+ def target_files
33
+ @target_files ||= (git.modified_files - git.deleted_files) + git.added_files
34
+ end
35
+
36
+ def exec_gradle_task
37
+ system "./gradlew #{gradle_task}"
38
+ end
39
+
40
+ def gradlew_exists?
41
+ `ls gradlew`.strip.empty? == false
42
+ end
43
+
44
+ def report_file_exist?
45
+ File.exists?(report_file)
46
+ end
47
+
48
+ def findbugs_report
49
+ @findbugs_report ||= Oga.parse_xml(File.open(report_file))
50
+ end
51
+
52
+ def bug_issues
53
+ @bug_issues ||= findbugs_report.xpath("//BugInstance").map do |buginfo|
54
+ BugIssue.new(gradle_module, buginfo)
55
+ end
56
+ end
57
+
58
+ def send_inline_comment
59
+ bug_issues.each do |issue|
60
+ next unless target_files.include? issue.absolute_path
61
+ send(issue.type, issue.description, file: issue.absolute_path, line: issue.line)
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,60 @@
1
+ require File.expand_path('../spec_helper', __FILE__)
2
+
3
+ module Danger
4
+ describe Danger::DangerFindbugs do
5
+ it 'should be a plugin' do
6
+ expect(Danger::DangerFindbugs.new(nil)).to be_a Danger::Plugin
7
+ end
8
+
9
+ describe 'with Dangerfile' do
10
+ before do
11
+ @dangerfile = testing_dangerfile
12
+ @my_plugin = @dangerfile.findbugs
13
+ end
14
+
15
+ it "Check default report file path" do
16
+ expect(@my_plugin.report_file).to eq('build/reports/findbugs_report.xml')
17
+ end
18
+
19
+ it "Set custom report file path" do
20
+ custom_report_path = 'custom/findbugs_report.xml'
21
+ @my_plugin.report_file = custom_report_path
22
+ expect(@my_plugin.report_file).to eq(custom_report_path)
23
+ end
24
+
25
+ it "Check default gradle module" do
26
+ expect(@my_plugin.gradle_module).to eq('app')
27
+ end
28
+
29
+ it "Set custom gradle module" do
30
+ my_module = 'custom_module'
31
+ @my_plugin.gradle_module = my_module
32
+ expect(@my_plugin.gradle_module).to eq(my_module)
33
+ end
34
+
35
+ it "Check default gradle task" do
36
+ expect(@my_plugin.gradle_task).to eq('findbugs')
37
+ end
38
+
39
+ it "Set custom gradle module" do
40
+ custom_task = 'findbugsStagingDebug'
41
+ @my_plugin.gradle_task = custom_task
42
+ expect(@my_plugin.gradle_task).to eq(custom_task)
43
+ end
44
+
45
+ it "Create bug issues" do
46
+ custom_report_path = 'spec/fixtures/findbugs_report.xml'
47
+ @my_plugin.report_file = custom_report_path
48
+ expect(@my_plugin.bug_issues).not_to be_nil
49
+ end
50
+
51
+ it "Send inline comments" do
52
+ Danger::DangerFindbugs.any_instance.stub(:target_files).and_return([])
53
+ custom_report_path = 'spec/fixtures/findbugs_report.xml'
54
+ @my_plugin.report_file = custom_report_path
55
+ expect(@my_plugin.send_inline_comment).not_to be_nil
56
+ end
57
+
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,100 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+
3
+ <BugCollection version="3.0.1" sequence="0" timestamp="1494198718192" analysisTimestamp="1494198718220" release="">
4
+ <Project projectName="">
5
+ <Jar>/Users/kazukiyoshida/.ghq/github.com/kazy1991/PrefKit/prefkit/build/intermediates/classes</Jar>
6
+ <SrcDir>/Users/kazukiyoshida/.ghq/github.com/kazy1991/PrefKit/prefkit/src/main/java/com/github/kazy1991/prefkit/annotation/PrefKey.java</SrcDir>
7
+ <SrcDir>/Users/kazukiyoshida/.ghq/github.com/kazy1991/PrefKit/prefkit/src/main/java/com/github/kazy1991/prefkit/annotation/PrefSchema.java</SrcDir>
8
+ <SrcDir>/Users/kazukiyoshida/.ghq/github.com/kazy1991/PrefKit/prefkit/src/main/java/com/github/kazy1991/prefkit/PreferenceHelper.java</SrcDir>
9
+ <SrcDir>/Users/kazukiyoshida/.ghq/github.com/kazy1991/PrefKit/prefkit/src/main/java/com/github/kazy1991/prefkit/PrefKit.java</SrcDir>
10
+ <SrcDir>/Users/kazukiyoshida/.ghq/github.com/kazy1991/PrefKit/prefkit/src/main/java/com/github/kazy1991/prefkit/ServiceMethod.java</SrcDir>
11
+ </Project>
12
+ <BugInstance type="MS_MUTABLE_COLLECTION_PKGPROTECT" priority="3" rank="20" abbrev="MS" category="MALICIOUS_CODE" instanceHash="97aa2fcc6946bb8365f48119cce74dcf" instanceOccurrenceNum="0" instanceOccurrenceMax="0" cweid="218">
13
+ <ShortMessage>&#12497;&#12483;&#12465;&#12540;&#12472;&#12503;&#12525;&#12486;&#12463;&#12486;&#12483;&#12489;&#12395;&#12377;&#12409;&#12365;&#21487;&#22793;&#12467;&#12524;&#12463;&#12471;&#12519;&#12531;&#12398;&#12501;&#12451;&#12540;&#12523;&#12489;</ShortMessage>
14
+ <LongMessage>com.github.kazy1991.prefkit.ServiceMethod.SUPPORT_LANG &#12399;&#12289;&#12497;&#12483;&#12465;&#12540;&#12472;&#12503;&#12525;&#12486;&#12463;&#12486;&#12483;&#12489;&#12395;&#12377;&#12409;&#12365;&#21487;&#22793;&#12467;&#12524;&#12463;&#12471;&#12519;&#12531;&#12391;&#12377;&#12290;</LongMessage>
15
+ <Class classname="com.github.kazy1991.prefkit.ServiceMethod" primary="true">
16
+ <SourceLine classname="com.github.kazy1991.prefkit.ServiceMethod" start="21" end="79" sourcefile="ServiceMethod.java" sourcepath="com/github/kazy1991/prefkit/ServiceMethod.java">
17
+ <Message>&#35442;&#24403;&#31623;&#25152; ServiceMethod.java:[lines 21-79]</Message>
18
+ </SourceLine>
19
+ <Message>&#12463;&#12521;&#12473; com.github.kazy1991.prefkit.ServiceMethod</Message>
20
+ </Class>
21
+ <Field classname="com.github.kazy1991.prefkit.ServiceMethod" name="SUPPORT_LANG" signature="Ljava/util/List;" isStatic="true" primary="true">
22
+ <SourceLine classname="com.github.kazy1991.prefkit.ServiceMethod" sourcefile="ServiceMethod.java" sourcepath="com/github/kazy1991/prefkit/ServiceMethod.java">
23
+ <Message>&#35442;&#24403;&#22580;&#25152; ServiceMethod.java</Message>
24
+ </SourceLine>
25
+ <Message>&#12501;&#12451;&#12540;&#12523;&#12489; com.github.kazy1991.prefkit.ServiceMethod.SUPPORT_LANG</Message>
26
+ </Field>
27
+ <SourceLine classname="com.github.kazy1991.prefkit.ServiceMethod" primary="true" start="21" end="21" startBytecode="19" endBytecode="19" sourcefile="ServiceMethod.java" sourcepath="com/github/kazy1991/prefkit/ServiceMethod.java">
28
+ <Message>&#35442;&#24403;&#31623;&#25152; ServiceMethod.java:[line 21]</Message>
29
+ </SourceLine>
30
+ </BugInstance>
31
+ <BugCategory category="MALICIOUS_CODE">
32
+ <Description>Malicious code vulnerability</Description>
33
+ </BugCategory>
34
+ <BugPattern type="MS_MUTABLE_COLLECTION_PKGPROTECT" abbrev="MS" category="MALICIOUS_CODE">
35
+ <ShortDescription>&#12497;&#12483;&#12465;&#12540;&#12472;&#12503;&#12525;&#12486;&#12463;&#12486;&#12483;&#12489;&#12395;&#12377;&#12409;&#12365;&#21487;&#22793;&#12467;&#12524;&#12463;&#12471;&#12519;&#12531;&#12398;&#12501;&#12451;&#12540;&#12523;&#12489;</ShortDescription>
36
+ <Details><![CDATA[
37
+
38
+ <p>
39
+ 可変コレクションのインスタンスが final static フィールドに割り当てられています。
40
+ したがって、悪意のあるコードや偶然別のパッケージによって変更できます。
41
+ フィールドは脆弱性を避けるためにパッケージプロテクテッドにできます。
42
+ 代わりに Collections.unmodifiableSet/List/Map などでこのフィールドをラップしても脆弱性を避けることができます。
43
+ </p>
44
+
45
+ ]]></Details>
46
+ </BugPattern>
47
+ <BugCode abbrev="MS" cweid="218">
48
+ <Description>&#21487;&#22793; static &#12501;&#12451;&#12540;&#12523;&#12489;</Description>
49
+ </BugCode>
50
+ <Errors errors="0" missingClasses="3">
51
+ <MissingClass>android.content.Context</MissingClass>
52
+ <MissingClass>android.content.SharedPreferences</MissingClass>
53
+ <MissingClass>android.content.SharedPreferences$Editor</MissingClass>
54
+ </Errors>
55
+ <FindBugsSummary timestamp="Mon, 8 May 2017 08:11:58 +0900" total_classes="10" referenced_classes="38" total_bugs="1" total_size="129" num_packages="2" java_version="1.8.0_121" vm_version="25.121-b13" cpu_seconds="5.27" clock_seconds="1.65" peak_mbytes="173.22" alloc_mbytes="3641.00" gc_seconds="0.02" priority_3="1">
56
+ <FileStats path="com/github/kazy1991/prefkit/BuildConfig.java" bugCount="0" size="11"/>
57
+ <FileStats path="com/github/kazy1991/prefkit/PrefKit.java" bugCount="0" size="19"/>
58
+ <FileStats path="com/github/kazy1991/prefkit/PreferenceHelper.java" bugCount="0" size="33"/>
59
+ <FileStats path="com/github/kazy1991/prefkit/R.java" bugCount="0" size="12"/>
60
+ <FileStats path="com/github/kazy1991/prefkit/ServiceMethod.java" bugCount="1" size="50" bugHash="dca3aa492bded41027195b70d8bbc129"/>
61
+ <FileStats path="com/github/kazy1991/prefkit/annotation/PrefKey.java" bugCount="0" size="2"/>
62
+ <FileStats path="com/github/kazy1991/prefkit/annotation/PrefSchema.java" bugCount="0" size="2"/>
63
+ <PackageStats package="com.github.kazy1991.prefkit" total_bugs="1" total_types="8" total_size="125" priority_3="1">
64
+ <ClassStats class="com.github.kazy1991.prefkit.BuildConfig" sourceFile="BuildConfig.java" interface="false" size="11" bugs="0"/>
65
+ <ClassStats class="com.github.kazy1991.prefkit.PrefKit" sourceFile="PrefKit.java" interface="false" size="10" bugs="0"/>
66
+ <ClassStats class="com.github.kazy1991.prefkit.PrefKit$1" sourceFile="PrefKit.java" interface="false" size="9" bugs="0"/>
67
+ <ClassStats class="com.github.kazy1991.prefkit.PreferenceHelper" sourceFile="PreferenceHelper.java" interface="false" size="33" bugs="0"/>
68
+ <ClassStats class="com.github.kazy1991.prefkit.R" sourceFile="R.java" interface="false" size="3" bugs="0"/>
69
+ <ClassStats class="com.github.kazy1991.prefkit.R$attr" sourceFile="R.java" interface="false" size="3" bugs="0"/>
70
+ <ClassStats class="com.github.kazy1991.prefkit.R$string" sourceFile="R.java" interface="false" size="6" bugs="0"/>
71
+ <ClassStats class="com.github.kazy1991.prefkit.ServiceMethod" sourceFile="ServiceMethod.java" interface="false" size="50" bugs="1" priority_3="1"/>
72
+ </PackageStats>
73
+ <PackageStats package="com.github.kazy1991.prefkit.annotation" total_bugs="0" total_types="2" total_size="4">
74
+ <ClassStats class="com.github.kazy1991.prefkit.annotation.PrefKey" sourceFile="PrefKey.java" interface="true" size="2" bugs="0"/>
75
+ <ClassStats class="com.github.kazy1991.prefkit.annotation.PrefSchema" sourceFile="PrefSchema.java" interface="true" size="2" bugs="0"/>
76
+ </PackageStats>
77
+ <FindBugsProfile>
78
+ <ClassProfile name="edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine" totalMilliseconds="292" invocations="443" avgMicrosecondsPerInvocation="660" maxMicrosecondsPerInvocation="19095" standardDeviationMircosecondsPerInvocation="1726"/>
79
+ <ClassProfile name="edu.umd.cs.findbugs.classfile.engine.ClassDataAnalysisEngine" totalMilliseconds="97" invocations="444" avgMicrosecondsPerInvocation="219" maxMicrosecondsPerInvocation="3246" standardDeviationMircosecondsPerInvocation="246"/>
80
+ <ClassProfile name="edu.umd.cs.findbugs.detect.FieldItemSummary" totalMilliseconds="78" invocations="38" avgMicrosecondsPerInvocation="2066" maxMicrosecondsPerInvocation="12094" standardDeviationMircosecondsPerInvocation="2921"/>
81
+ <ClassProfile name="edu.umd.cs.findbugs.OpcodeStack$JumpInfoFactory" totalMilliseconds="52" invocations="171" avgMicrosecondsPerInvocation="306" maxMicrosecondsPerInvocation="4631" standardDeviationMircosecondsPerInvocation="558"/>
82
+ <ClassProfile name="edu.umd.cs.findbugs.util.TopologicalSort" totalMilliseconds="51" invocations="405" avgMicrosecondsPerInvocation="126" maxMicrosecondsPerInvocation="1758" standardDeviationMircosecondsPerInvocation="233"/>
83
+ <ClassProfile name="edu.umd.cs.findbugs.classfile.engine.bcel.MethodGenFactory" totalMilliseconds="48" invocations="31" avgMicrosecondsPerInvocation="1559" maxMicrosecondsPerInvocation="42157" standardDeviationMircosecondsPerInvocation="7415"/>
84
+ <ClassProfile name="edu.umd.cs.findbugs.detect.FindNoSideEffectMethods" totalMilliseconds="48" invocations="38" avgMicrosecondsPerInvocation="1263" maxMicrosecondsPerInvocation="8159" standardDeviationMircosecondsPerInvocation="1852"/>
85
+ <ClassProfile name="edu.umd.cs.findbugs.classfile.engine.bcel.JavaClassAnalysisEngine" totalMilliseconds="43" invocations="60" avgMicrosecondsPerInvocation="728" maxMicrosecondsPerInvocation="19985" standardDeviationMircosecondsPerInvocation="2649"/>
86
+ <ClassProfile name="edu.umd.cs.findbugs.detect.NoteDirectlyRelevantTypeQualifiers" totalMilliseconds="35" invocations="38" avgMicrosecondsPerInvocation="923" maxMicrosecondsPerInvocation="7163" standardDeviationMircosecondsPerInvocation="1591"/>
87
+ <ClassProfile name="edu.umd.cs.findbugs.classfile.engine.bcel.TypeDataflowFactory" totalMilliseconds="30" invocations="29" avgMicrosecondsPerInvocation="1038" maxMicrosecondsPerInvocation="11218" standardDeviationMircosecondsPerInvocation="2102"/>
88
+ <ClassProfile name="edu.umd.cs.findbugs.classfile.engine.bcel.CFGFactory" totalMilliseconds="28" invocations="29" avgMicrosecondsPerInvocation="986" maxMicrosecondsPerInvocation="12611" standardDeviationMircosecondsPerInvocation="2366"/>
89
+ <ClassProfile name="edu.umd.cs.findbugs.classfile.engine.bcel.IsNullValueDataflowFactory" totalMilliseconds="28" invocations="29" avgMicrosecondsPerInvocation="984" maxMicrosecondsPerInvocation="7784" standardDeviationMircosecondsPerInvocation="1531"/>
90
+ <ClassProfile name="edu.umd.cs.findbugs.classfile.engine.bcel.ValueNumberDataflowFactory" totalMilliseconds="27" invocations="29" avgMicrosecondsPerInvocation="931" maxMicrosecondsPerInvocation="11175" standardDeviationMircosecondsPerInvocation="2081"/>
91
+ <ClassProfile name="edu.umd.cs.findbugs.detect.FunctionsThatMightBeMistakenForProcedures" totalMilliseconds="22" invocations="38" avgMicrosecondsPerInvocation="594" maxMicrosecondsPerInvocation="5363" standardDeviationMircosecondsPerInvocation="1197"/>
92
+ <ClassProfile name="edu.umd.cs.findbugs.classfile.engine.bcel.UnconditionalValueDerefDataflowFactory" totalMilliseconds="22" invocations="29" avgMicrosecondsPerInvocation="776" maxMicrosecondsPerInvocation="4901" standardDeviationMircosecondsPerInvocation="1065"/>
93
+ <ClassProfile name="edu.umd.cs.findbugs.ba.npe.NullDerefAndRedundantComparisonFinder" totalMilliseconds="22" invocations="29" avgMicrosecondsPerInvocation="771" maxMicrosecondsPerInvocation="5447" standardDeviationMircosecondsPerInvocation="1064"/>
94
+ <ClassProfile name="edu.umd.cs.findbugs.detect.BuildStringPassthruGraph" totalMilliseconds="22" invocations="38" avgMicrosecondsPerInvocation="585" maxMicrosecondsPerInvocation="8394" standardDeviationMircosecondsPerInvocation="1457"/>
95
+ <ClassProfile name="edu.umd.cs.findbugs.detect.OverridingEqualsNotSymmetrical" totalMilliseconds="22" invocations="38" avgMicrosecondsPerInvocation="582" maxMicrosecondsPerInvocation="7272" standardDeviationMircosecondsPerInvocation="1293"/>
96
+ </FindBugsProfile>
97
+ </FindBugsSummary>
98
+ <ClassFeatures></ClassFeatures>
99
+ <History></History>
100
+ </BugCollection>
@@ -0,0 +1,59 @@
1
+ require 'pathname'
2
+ ROOT = Pathname.new(File.expand_path('../../', __FILE__))
3
+ $:.unshift((ROOT + 'lib').to_s)
4
+ $:.unshift((ROOT + 'spec').to_s)
5
+
6
+ require 'bundler/setup'
7
+ require 'pry'
8
+
9
+ require 'rspec'
10
+ require 'danger'
11
+
12
+ # Use coloured output, it's the best.
13
+ RSpec.configure do |config|
14
+ config.filter_gems_from_backtrace "bundler"
15
+ config.color = true
16
+ config.tty = true
17
+ end
18
+
19
+ require 'danger_plugin'
20
+
21
+ # These functions are a subset of https://github.com/danger/danger/blob/master/spec/spec_helper.rb
22
+ # If you are expanding these files, see if it's already been done ^.
23
+
24
+ # A silent version of the user interface,
25
+ # it comes with an extra function `.string` which will
26
+ # strip all ANSI colours from the string.
27
+
28
+ # rubocop:disable Lint/NestedMethodDefinition
29
+ def testing_ui
30
+ @output = StringIO.new
31
+ def @output.winsize
32
+ [20, 9999]
33
+ end
34
+
35
+ cork = Cork::Board.new(out: @output)
36
+ def cork.string
37
+ out.string.gsub(/\e\[([;\d]+)?m/, "")
38
+ end
39
+ cork
40
+ end
41
+ # rubocop:enable Lint/NestedMethodDefinition
42
+
43
+ # Example environment (ENV) that would come from
44
+ # running a PR on TravisCI
45
+ def testing_env
46
+ {
47
+ 'HAS_JOSH_K_SEAL_OF_APPROVAL' => 'true',
48
+ 'TRAVIS_PULL_REQUEST' => '800',
49
+ 'TRAVIS_REPO_SLUG' => 'artsy/eigen',
50
+ 'TRAVIS_COMMIT_RANGE' => '759adcbd0d8f...13c4dc8bb61d',
51
+ 'DANGER_GITHUB_API_TOKEN' => '123sbdq54erfsd3422gdfio'
52
+ }
53
+ end
54
+
55
+ # A stubbed out Dangerfile for use in tests
56
+ def testing_dangerfile
57
+ env = Danger::EnvironmentManager.new(testing_env)
58
+ Danger::Dangerfile.new(env, testing_ui)
59
+ end
metadata ADDED
@@ -0,0 +1,219 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: danger-findbugs
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - kazuki-yoshida
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-05-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: danger-plugin-api
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: oga
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.10'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.10'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.4'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.4'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.41'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.41'
97
+ - !ruby/object:Gem::Dependency
98
+ name: yard
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.8'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.8'
111
+ - !ruby/object:Gem::Dependency
112
+ name: guard
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '2.14'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '2.14'
125
+ - !ruby/object:Gem::Dependency
126
+ name: guard-rspec
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '4.7'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '4.7'
139
+ - !ruby/object:Gem::Dependency
140
+ name: listen
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '='
144
+ - !ruby/object:Gem::Version
145
+ version: 3.0.7
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '='
151
+ - !ruby/object:Gem::Version
152
+ version: 3.0.7
153
+ - !ruby/object:Gem::Dependency
154
+ name: pry
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ description: A short description of danger-findbugs.
168
+ email:
169
+ - kzk.yshd@gmail.com
170
+ executables: []
171
+ extensions: []
172
+ extra_rdoc_files: []
173
+ files:
174
+ - ".gitignore"
175
+ - ".travis.yml"
176
+ - Gemfile
177
+ - Gemfile.lock
178
+ - Guardfile
179
+ - LICENSE
180
+ - LICENSE.txt
181
+ - README.md
182
+ - Rakefile
183
+ - danger-findbugs.gemspec
184
+ - lib/danger_findbugs.rb
185
+ - lib/danger_plugin.rb
186
+ - lib/findbugs/bug_issue.rb
187
+ - lib/findbugs/gem_version.rb
188
+ - lib/findbugs/plugin.rb
189
+ - spec/findbugs_spec.rb
190
+ - spec/fixtures/findbugs_report.xml
191
+ - spec/spec_helper.rb
192
+ homepage: https://github.com/kazuki-yoshida/danger-findbugs
193
+ licenses:
194
+ - MIT
195
+ metadata: {}
196
+ post_install_message:
197
+ rdoc_options: []
198
+ require_paths:
199
+ - lib
200
+ required_ruby_version: !ruby/object:Gem::Requirement
201
+ requirements:
202
+ - - ">="
203
+ - !ruby/object:Gem::Version
204
+ version: '0'
205
+ required_rubygems_version: !ruby/object:Gem::Requirement
206
+ requirements:
207
+ - - ">="
208
+ - !ruby/object:Gem::Version
209
+ version: '0'
210
+ requirements: []
211
+ rubyforge_project:
212
+ rubygems_version: 2.6.8
213
+ signing_key:
214
+ specification_version: 4
215
+ summary: A longer description of danger-findbugs.
216
+ test_files:
217
+ - spec/findbugs_spec.rb
218
+ - spec/fixtures/findbugs_report.xml
219
+ - spec/spec_helper.rb