danger-checkstyle_xml 0.0.4 → 0.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6a8b8d75c19a4f35e52e7b693c59a9fd0408d5a0bf3366d29d9c3d994c7ce1ec
4
- data.tar.gz: 4ca58f174e08d545f78f37537b25db80944f022df0cf9a4d8a3acc6e75f2ab70
3
+ metadata.gz: cd740ce3fb5ca517dc3568735af078687506142537344f1ce5ae60f74f130a10
4
+ data.tar.gz: 5470bd1a659ec87a018802f9b86dd79e1ba7a819ace0b7a6751b648130967a86
5
5
  SHA512:
6
- metadata.gz: 8dade669190655478d6fbae812cfc4104b12b3a5b891d9f40eb3fa34f8e650f97ada8a1fc9a5235295c5579874319a26ff4450bb57f5ebe77bff19f5a3f9d7f2
7
- data.tar.gz: 92095613700a1afbd85e2d2564b26daf5b93bea11c5b0e4650abb71f3561d59cee2d416134135cab075c9bcce0600809379fe59b631dc6bf58930332a6cc4748
6
+ metadata.gz: d8b7bfb39e30907edf9f64b2b16645631a1ef457403c1d25ad0f9daa0171e00fc11dcb6e675a1d910e7a855e8ea164409c63b868d9e65ae9a990cc8f968fec86
7
+ data.tar.gz: ffe9414bd5b548a51f536e43cfa33e578dfedf9435373a588c1cf6b79c289438a2489f19c734752be27f22be4df3ce48d0bc2685fcb56f89f3454061cbbd00cc
data/.rubocop.yml CHANGED
@@ -17,13 +17,16 @@ Lint/UselessAssignment:
17
17
  Exclude:
18
18
  - '**/spec/**/*'
19
19
 
20
- # We could potentially enable the 2 below:
20
+ # We could potentially enable the 3 below:
21
21
  Layout/FirstHashElementIndentation:
22
22
  Enabled: false
23
23
 
24
24
  Layout/HashAlignment:
25
25
  Enabled: false
26
26
 
27
+ Layout/EndOfLine:
28
+ Enabled: false
29
+
27
30
  # HoundCI doesn't like this rule
28
31
  Layout/DotPosition:
29
32
  Enabled: false
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- danger-checkstyle_xml (0.0.1)
4
+ danger-checkstyle_xml (0.0.5)
5
5
  danger-plugin-api (~> 1.0)
6
6
  ox (~> 2.14)
7
7
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  CheckstyleError = Struct.new(:file_name, :line, :column, :severity, :message, :source) do
4
- def self.generate(node, parent_node, sub_regex)
4
+ def self.generate(node, parent_node, sub_regex)
5
5
  relative_path = parent_node[:name].sub(sub_regex, "")
6
6
 
7
7
  CheckstyleError.new(
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CheckstyleFormat
4
- VERSION = "0.0.4".freeze
4
+ VERSION = "0.0.5"
5
5
  end
@@ -7,22 +7,22 @@ module Danger
7
7
  #
8
8
  # @example Parse the XML file, and let the plugin do your reporting
9
9
  #
10
- # checkstyle_format.base_path = Dir.pwd
10
+ # checkstyle_format.base_regex = %r{^.*?\/src\/}
11
11
  # checkstyle_format.report 'app/build/reports/checkstyle/checkstyle.xml'
12
12
  #
13
13
  # @example Parse the XML text, and let the plugin do your reporting
14
14
  #
15
- # checkstyle_format.base_path = Dir.pwd
15
+ # checkstyle_format.base_regex = %r{^.*?\/src\/}
16
16
  # checkstyle_format.report_by_text '<?xml ...'
17
17
  #
18
18
  # @see noboru-i/danger-checkstyle_format
19
19
  # @tags lint, reporting
20
20
  #
21
21
  class DangerCheckstyleFormat < Plugin
22
- # Base path of `name` attributes in `file` tag.
22
+ # Base regex for converting the full paths into relative paths.
23
23
  # Defaults to nil.
24
24
  # @return [String]
25
- attr_accessor :base_path
25
+ attr_accessor :base_regex
26
26
 
27
27
  # Report checkstyle warnings
28
28
  #
@@ -57,13 +57,10 @@ module Danger
57
57
  present_elements = doc.nodes.first.nodes.reject do |test|
58
58
  test.nodes.empty?
59
59
  end
60
-
61
- # base_path_suffix = @base_path.end_with?("/") ? "" : "/"
62
- # base_path = @base_path + base_path_suffix
63
60
 
64
61
  present_elements.flat_map do |parent|
65
62
  parent.nodes.map do |child|
66
- CheckstyleError.generate(child, parent, @base_path)
63
+ CheckstyleError.generate(child, parent, @base_regex)
67
64
  end
68
65
  end
69
66
  end
@@ -72,13 +69,14 @@ module Danger
72
69
  if inline_mode
73
70
  send_inline_comment(errors)
74
71
  else
75
- raise "not implemented." # TODO: not implemented.
72
+ # TODO: not implemented.
73
+ raise "Not implemented."
76
74
  end
77
75
  end
78
76
 
79
77
  def send_inline_comment(errors)
80
78
  errors.each do |error|
81
- puts "Sending inline comment to file #{error.file_name}, line #{error.line}"
79
+ # puts "Sending inline comment to file #{error.file_name}, line #{error.line}"
82
80
  warn(error.message, file: error.file_name, line: error.line)
83
81
  end
84
82
  end
@@ -29,7 +29,7 @@ module Danger
29
29
 
30
30
  describe ".parse" do
31
31
  subject(:errors) do
32
- @checkstyle_format.base_path = "/path/to"
32
+ @checkstyle_format.base_regex = %r{^.*?/to/}
33
33
  @checkstyle_format.send(:parse, File.read("spec/fixtures/checkstyle.xml"))
34
34
  end
35
35
  it "have 4 items" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-checkstyle_xml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - noboru-i