findbugs_translate_checkstyle_format 0.1.6 → 0.2.0
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/.coveralls.yml +1 -0
- data/.gitignore +2 -0
- data/.rubocop.yml +8 -0
- data/README.md +16 -3
- data/Rakefile +3 -3
- data/bin/console +3 -3
- data/exe/findbugs_translate_checkstyle_format +1 -1
- data/findbugs_translate_checkstyle_format.gemspec +13 -12
- data/lib/findbugs_translate_checkstyle_format/translate.rb +40 -25
- data/lib/findbugs_translate_checkstyle_format/version.rb +1 -1
- data/lib/findbugs_translate_checkstyle_format.rb +2 -2
- metadata +19 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7867d159bd387785e12961f0aefc24dcf16b670
|
4
|
+
data.tar.gz: 2b3bae8fab45a7aba5c7eb0522894809fd47b2df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b8ed8a89965516a156fbf72984aa6858c07a8d5507b53fa46d7c540384afbe1b7159c416ae5e3b97ff3ce82224255cee79bae03c8e4ba94d30c95d986052db3
|
7
|
+
data.tar.gz: 22e0f4709d39530c9d5a3238a750a6e5e88497cbe3e0f90fd715567e9835dd9c9c3c26889d564db30d5f8fbb29f5429507c1088272d7c6aaf843fb839c0c8bb0
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
data/.rubocop.yml
ADDED
data/README.md
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
# FindbugsTranslateCheckstyleFormat
|
2
2
|
|
3
|
-
|
3
|
+
[](http://badge.fury.io/rb/findbugs_translate_checkstyle_format)
|
4
|
+
[](https://travis-ci.org/noboru-i/findbugs_translate_checkstyle_format)
|
5
|
+
[](https://codeclimate.com/github/noboru-i/findbugs_translate_checkstyle_format)
|
6
|
+
[](https://coveralls.io/r/noboru-i/findbugs_translate_checkstyle_format)
|
4
7
|
|
5
|
-
|
8
|
+
Translate findbugs format into checkstyle format.
|
6
9
|
|
7
10
|
## Installation
|
8
11
|
|
@@ -22,7 +25,17 @@ Or install it yourself as:
|
|
22
25
|
|
23
26
|
## Usage
|
24
27
|
|
25
|
-
|
28
|
+
### Use pipe
|
29
|
+
|
30
|
+
```
|
31
|
+
cat findbugs.xml | findbugs_translate_checkstyle_format translate
|
32
|
+
```
|
33
|
+
|
34
|
+
### Use command-line option
|
35
|
+
|
36
|
+
```
|
37
|
+
findbugs_translate_checkstyle_format translate --file="findbugs.xml"
|
38
|
+
```
|
26
39
|
|
27
40
|
## Development
|
28
41
|
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'findbugs_translate_checkstyle_format'
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +10,5 @@ require "findbugs_translate_checkstyle_format"
|
|
10
10
|
# require "pry"
|
11
11
|
# Pry.start
|
12
12
|
|
13
|
-
require
|
13
|
+
require 'irb'
|
14
14
|
IRB.start
|
@@ -4,25 +4,26 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'findbugs_translate_checkstyle_format/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'findbugs_translate_checkstyle_format'
|
8
8
|
spec.version = FindbugsTranslateCheckstyleFormat::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ['noboru-i']
|
10
|
+
spec.email = ['ishikura.noboru@gmail.com']
|
11
11
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
14
|
-
spec.homepage =
|
15
|
-
spec.license =
|
12
|
+
spec.summary = 'Translate findbugs format into checkstyle format.'
|
13
|
+
spec.description = 'Translate findbugs format into checkstyle format.'
|
14
|
+
spec.homepage = 'https://github.com/noboru-i/findbugs_translate_checkstyle_format'
|
15
|
+
spec.license = 'MIT'
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
-
spec.bindir =
|
18
|
+
spec.bindir = 'exe'
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
-
spec.require_paths = [
|
20
|
+
spec.require_paths = ['lib']
|
21
21
|
|
22
22
|
spec.add_runtime_dependency 'thor'
|
23
23
|
spec.add_runtime_dependency 'nori'
|
24
24
|
|
25
|
-
spec.add_development_dependency
|
26
|
-
spec.add_development_dependency
|
27
|
-
spec.add_development_dependency
|
25
|
+
spec.add_development_dependency 'bundler', '~> 1.10'
|
26
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
27
|
+
spec.add_development_dependency 'rspec'
|
28
|
+
spec.add_development_dependency 'coveralls'
|
28
29
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'nori'
|
2
|
+
require 'rexml/document'
|
2
3
|
|
3
4
|
module FindbugsTranslateCheckstyleFormat
|
4
5
|
module Translate
|
@@ -9,39 +10,53 @@ module FindbugsTranslateCheckstyleFormat
|
|
9
10
|
end
|
10
11
|
|
11
12
|
def trans(xml)
|
12
|
-
require 'rexml/document'
|
13
13
|
doc = REXML::Document.new
|
14
14
|
doc << REXML::XMLDecl.new('1.0', 'UTF-8')
|
15
15
|
|
16
|
-
checkstyle = doc.add_element(
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
})
|
16
|
+
checkstyle = doc.add_element('checkstyle')
|
17
|
+
bug_instances = xml['BugCollection']['BugInstance']
|
18
|
+
if bug_instances.blank?
|
19
|
+
FindbugsTranslateCheckstyleFormat::Translate.set_dummy(xml, checkstyle)
|
20
|
+
return doc
|
21
|
+
end
|
22
|
+
|
23
|
+
bug_instances = [bug_instances] if bug_instances.is_a?(Hash)
|
24
|
+
bug_instances.each do |bug_instance|
|
25
|
+
source_line = bug_instance['SourceLine']
|
26
|
+
file = checkstyle.add_element('file',
|
27
|
+
'name' => FindbugsTranslateCheckstyleFormat::Translate.fqcn_to_path(source_line['@classname'], xml)
|
28
|
+
)
|
29
|
+
file.add_element('error',
|
30
|
+
'line' => source_line['@start'],
|
31
|
+
'severity' => 'error',
|
32
|
+
'message' => FindbugsTranslateCheckstyleFormat::Translate.create_message(bug_instance)
|
33
|
+
)
|
35
34
|
end
|
36
35
|
|
37
36
|
doc
|
38
37
|
end
|
39
38
|
|
40
|
-
def fqcn_to_path(fqcn, xml)
|
41
|
-
path = fqcn.
|
42
|
-
xml['BugCollection']['Project']['SrcDir']
|
43
|
-
|
44
|
-
|
39
|
+
def self.fqcn_to_path(fqcn, xml)
|
40
|
+
path = fqcn.tr('.', '/') + '.java'
|
41
|
+
src_dirs = xml['BugCollection']['Project']['SrcDir']
|
42
|
+
src_dirs = [src_dirs] unless src_dirs.is_a?(Array)
|
43
|
+
src_dirs.find { |src| !src.index(path).nil? }
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.set_dummy(xml, checkstyle)
|
47
|
+
dummy_src_dir = xml['BugCollection']['Project']['SrcDir']
|
48
|
+
dummy_src_dir = dummy_src_dir.first if dummy_src_dir.is_a?(Array)
|
49
|
+
|
50
|
+
checkstyle.add_element('file',
|
51
|
+
'name' => dummy_src_dir
|
52
|
+
)
|
53
|
+
|
54
|
+
checkstyle
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.create_message(bug_instance)
|
58
|
+
link = "http://findbugs.sourceforge.net/bugDescriptions.html##{bug_instance['@type']}"
|
59
|
+
"[#{bug_instance['@category']}][#{bug_instance['@type']}] #{bug_instance['LongMessage']}\n#{link}"
|
45
60
|
end
|
46
61
|
end
|
47
62
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'findbugs_translate_checkstyle_format/version'
|
2
|
+
require 'findbugs_translate_checkstyle_format/translate'
|
3
3
|
|
4
4
|
module FindbugsTranslateCheckstyleFormat
|
5
5
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: findbugs_translate_checkstyle_format
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- noboru-i
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: coveralls
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
description: Translate findbugs format into checkstyle format.
|
84
98
|
email:
|
85
99
|
- ishikura.noboru@gmail.com
|
@@ -88,8 +102,10 @@ executables:
|
|
88
102
|
extensions: []
|
89
103
|
extra_rdoc_files: []
|
90
104
|
files:
|
105
|
+
- ".coveralls.yml"
|
91
106
|
- ".gitignore"
|
92
107
|
- ".rspec"
|
108
|
+
- ".rubocop.yml"
|
93
109
|
- ".travis.yml"
|
94
110
|
- CODE_OF_CONDUCT.md
|
95
111
|
- Gemfile
|
@@ -124,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
140
|
version: '0'
|
125
141
|
requirements: []
|
126
142
|
rubyforge_project:
|
127
|
-
rubygems_version: 2.4.
|
143
|
+
rubygems_version: 2.4.5
|
128
144
|
signing_key:
|
129
145
|
specification_version: 4
|
130
146
|
summary: Translate findbugs format into checkstyle format.
|