danger-checkstyle_format 0.0.1 → 0.0.3

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
  SHA1:
3
- metadata.gz: 1ddb72081274d10636f6d556a7fe7501da811b07
4
- data.tar.gz: 1159684bfdadea14876e58bdcb0a821d567f6342
3
+ metadata.gz: 245382d3418dad68da9c0b7a78e43e12a3c37539
4
+ data.tar.gz: d873072e053cccae270afc39a9b246a53afe7ce5
5
5
  SHA512:
6
- metadata.gz: 402f2c09db9fe9aff340eaa673de83064695f8eddc7679624c3859f5c9659850b21b0cd532e8a6b09486064e50173a638db09b3484efb37d91e6f0180c28bc58
7
- data.tar.gz: c7bb3b01c6e03bc309077d88a820a051af9fbbdbad1da88564e90c0e10eac991ec7a3a0b9f75f45b9e294fd465d233888811e3f7e1e2f3203a45602e6846c775
6
+ metadata.gz: 15416beb75052d6cb3ba27a1e83fee925c60005210907fe49d1bda606c4ec0da5ced05a5267a10134f9077483f20249cbc8ef65be2c12099895e7b2013f1f69b
7
+ data.tar.gz: 06a4c73c61416644fca82a477436968fcf940d6f42f3dcc7879d51f7e628c6299a0b7c33eadbe8eac91d0f6f71cebc9d709bbdbf8972ae5f7d94981f0a164399
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- danger-checkstyle_format (0.0.1)
4
+ danger-checkstyle_format (0.0.3)
5
5
  danger-plugin-api (~> 1.0)
6
6
  ox (~> 2.0)
7
7
 
data/README.md CHANGED
@@ -12,7 +12,8 @@ Danger plugin for checkstyle formatted xml file.
12
12
 
13
13
  <blockquote>Parse the XML file, and let the plugin do your reporting
14
14
  <pre>
15
- checkstyle_format.report "/path/to/output.xml"</pre>
15
+ checkstyle_format.base_path = Dir.pwd
16
+ checkstyle_format.report 'app/build/reports/checkstyle/checkstyle.xml'</pre>
16
17
  </blockquote>
17
18
 
18
19
  ## Development
@@ -1,3 +1,3 @@
1
1
  module CheckstyleFormat
2
- VERSION = "0.0.1".freeze
2
+ VERSION = "0.0.3".freeze
3
3
  end
@@ -3,7 +3,8 @@ module Danger
3
3
  #
4
4
  # @example Parse the XML file, and let the plugin do your reporting
5
5
  #
6
- # checkstyle_format.report
6
+ # checkstyle_format.base_path = Dir.pwd
7
+ # checkstyle_format.report 'app/build/reports/checkstyle/checkstyle.xml'
7
8
  #
8
9
  # @see noboru-i/danger-checkstyle_format
9
10
  # @tags lint, reporting
@@ -22,8 +23,6 @@ module Danger
22
23
  raise "No checkstyle file was found at #{file}" unless File.exist? file
23
24
  errors = parse(file)
24
25
 
25
- puts errors.size
26
-
27
26
  if inline_mode
28
27
  send_inline_comment(errors)
29
28
  else
@@ -53,9 +52,11 @@ module Danger
53
52
  present_elements = doc.nodes.first.nodes.reject do |test|
54
53
  test.nodes.empty?
55
54
  end
55
+ base_path_suffix = @base_path.end_with?("/") ? "" : "/"
56
+ base_path = @base_path + base_path_suffix
56
57
  elements = present_elements.flat_map do |parent|
57
58
  parent.nodes.map do |child|
58
- CheckstyleError.generate(child, parent, @base_path)
59
+ CheckstyleError.generate(child, parent, base_path)
59
60
  end
60
61
  end
61
62
 
@@ -27,7 +27,7 @@ module Danger
27
27
 
28
28
  describe ".parse" do
29
29
  subject(:errors) do
30
- @checkstyle_format.base_path = "/path/to/"
30
+ @checkstyle_format.base_path = "/path/to"
31
31
  @checkstyle_format.send(:parse, "spec/fixtures/checkstyle.xml")
32
32
  end
33
33
  it "have 4 items" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-checkstyle_format
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - noboru-i