danger-checkstyle_xml 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7eb6175f67f118fbb317b798f13ffda5a4ff62114b417f8521ee569881405eae
4
+ data.tar.gz: 175d8c97c9145e5bb2c5c9003c5471e027801b5abd08017f2b732189dcf1705e
5
+ SHA512:
6
+ metadata.gz: d6a422d21c6b7b0bf1db9b2abc710411cdcbfae3a1a38881004619f58238542c7efe63be6c67f6cbc4a10819673209f91ae5be758065aa5fc7b4949b0bcbf832
7
+ data.tar.gz: eccd772bfa33a6b0c72e0e66d60ac15608249507768c25d42e1bdeda87e29a9976791e03f5312b46b851b8bb676db842fe247878700c8413071b555400c2db2e
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ .DS_Store
2
+ pkg
3
+ .idea/
4
+ .yardoc
5
+
6
+ ## Environment normalization:
7
+ /.bundle/
8
+ /vendor/bundle
9
+ /lib/bundler/man/
data/.rubocop.yml ADDED
@@ -0,0 +1,147 @@
1
+ # Defaults can be found here: https://github.com/bbatsov/rubocop/blob/master/config/default.yml
2
+
3
+ AllCops:
4
+ TargetRubyVersion: 3
5
+ NewCops: enable
6
+
7
+ Style/StringLiterals:
8
+ EnforcedStyle: double_quotes
9
+ Enabled: true
10
+
11
+ # kind_of? is a good way to check a type
12
+ Style/ClassCheck:
13
+ EnforcedStyle: kind_of?
14
+
15
+ # specs sometimes have useless assignments, which is fine
16
+ Lint/UselessAssignment:
17
+ Exclude:
18
+ - '**/spec/**/*'
19
+
20
+ # We could potentially enable the 2 below:
21
+ Layout/FirstHashElementIndentation:
22
+ Enabled: false
23
+
24
+ Layout/HashAlignment:
25
+ Enabled: false
26
+
27
+ # HoundCI doesn't like this rule
28
+ Layout/DotPosition:
29
+ Enabled: false
30
+
31
+ # We allow !! as it's an easy way to convert ot boolean
32
+ Style/DoubleNegation:
33
+ Enabled: false
34
+
35
+ # Cop supports --auto-correct.
36
+ Lint/UnusedBlockArgument:
37
+ Enabled: false
38
+
39
+ # We want to allow class Fastlane::Class
40
+ Style/ClassAndModuleChildren:
41
+ Enabled: false
42
+
43
+ Metrics/AbcSize:
44
+ Max: 60
45
+
46
+ # The %w might be confusing for new users
47
+ Style/WordArray:
48
+ MinSize: 19
49
+
50
+ # raise and fail are both okay
51
+ Style/SignalException:
52
+ Enabled: false
53
+
54
+ # Better too much 'return' than one missing
55
+ Style/RedundantReturn:
56
+ Enabled: false
57
+
58
+ # Having if in the same line might not always be good
59
+ Style/IfUnlessModifier:
60
+ Enabled: false
61
+
62
+ # and and or is okay
63
+ Style/AndOr:
64
+ Enabled: false
65
+
66
+ # Configuration parameters: CountComments.
67
+ Metrics/ClassLength:
68
+ Max: 350
69
+
70
+ Metrics/CyclomaticComplexity:
71
+ Max: 17
72
+
73
+ # Configuration parameters: AllowURI, URISchemes.
74
+ Layout/LineLength:
75
+ Max: 370
76
+
77
+ # Configuration parameters: CountKeywordArgs.
78
+ Metrics/ParameterLists:
79
+ Max: 10
80
+
81
+ Metrics/PerceivedComplexity:
82
+ Max: 18
83
+
84
+ # Sometimes it's easier to read without guards
85
+ Style/GuardClause:
86
+ Enabled: false
87
+
88
+ # something = if something_else
89
+ # that's confusing
90
+ Style/ConditionalAssignment:
91
+ Enabled: false
92
+
93
+ # Better to have too much self than missing a self
94
+ Style/RedundantSelf:
95
+ Enabled: false
96
+
97
+ Metrics/MethodLength:
98
+ Max: 60
99
+
100
+ # We're not there yet
101
+ Style/Documentation:
102
+ Enabled: false
103
+
104
+ # Adds complexity
105
+ Style/IfInsideElse:
106
+ Enabled: false
107
+
108
+ # danger specific
109
+
110
+ Style/BlockComments:
111
+ Enabled: false
112
+
113
+ Layout/MultilineMethodCallIndentation:
114
+ EnforcedStyle: indented
115
+
116
+ # FIXME: 25
117
+ Metrics/BlockLength:
118
+ Max: 345
119
+ Exclude:
120
+ - "**/*_spec.rb"
121
+
122
+ Style/MixinGrouping:
123
+ Enabled: false
124
+
125
+ Naming/FileName:
126
+ Enabled: false
127
+
128
+ Layout/HeredocIndentation:
129
+ Enabled: false
130
+
131
+ Style/SpecialGlobalVars:
132
+ Enabled: false
133
+
134
+ Style/PercentLiteralDelimiters:
135
+ PreferredDelimiters:
136
+ "%": ()
137
+ "%i": ()
138
+ "%q": ()
139
+ "%Q": ()
140
+ "%r": "{}"
141
+ "%s": ()
142
+ "%w": ()
143
+ "%W": ()
144
+ "%x": ()
145
+
146
+ Security/YAMLLoad:
147
+ Enabled: false
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.2.0
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+ cache:
3
+ directories:
4
+ - bundle
5
+
6
+ rvm:
7
+ - 2.2.7
8
+ - 2.3.3
9
+ - 2.4.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-checkstyle_format.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,162 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ danger-checkstyle_xml (0.0.1)
5
+ danger-plugin-api (~> 1.0)
6
+ ox (~> 2.14)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ addressable (2.8.6)
12
+ public_suffix (>= 2.0.2, < 6.0)
13
+ ast (2.4.2)
14
+ base64 (0.2.0)
15
+ claide (1.1.0)
16
+ claide-plugins (0.9.2)
17
+ cork
18
+ nap
19
+ open4 (~> 1.3)
20
+ coderay (1.1.3)
21
+ colored2 (3.1.2)
22
+ cork (0.3.0)
23
+ colored2 (~> 3.1)
24
+ danger (9.4.3)
25
+ claide (~> 1.0)
26
+ claide-plugins (>= 0.9.2)
27
+ colored2 (~> 3.1)
28
+ cork (~> 0.1)
29
+ faraday (>= 0.9.0, < 3.0)
30
+ faraday-http-cache (~> 2.0)
31
+ git (~> 1.13)
32
+ kramdown (~> 2.3)
33
+ kramdown-parser-gfm (~> 1.0)
34
+ no_proxy_fix
35
+ octokit (>= 4.0)
36
+ terminal-table (>= 1, < 4)
37
+ danger-plugin-api (1.0.0)
38
+ danger (> 2.0)
39
+ diff-lcs (1.5.0)
40
+ faraday (2.9.0)
41
+ faraday-net_http (>= 2.0, < 3.2)
42
+ faraday-http-cache (2.5.1)
43
+ faraday (>= 0.8)
44
+ faraday-net_http (3.1.0)
45
+ net-http
46
+ ffi (1.15.5)
47
+ formatador (1.1.0)
48
+ git (1.19.1)
49
+ addressable (~> 2.8)
50
+ rchardet (~> 1.8)
51
+ guard (2.18.0)
52
+ formatador (>= 0.2.4)
53
+ listen (>= 2.7, < 4.0)
54
+ lumberjack (>= 1.0.12, < 2.0)
55
+ nenv (~> 0.1)
56
+ notiffany (~> 0.0)
57
+ pry (>= 0.13.0)
58
+ shellany (~> 0.0)
59
+ thor (>= 0.18.1)
60
+ guard-compat (1.2.1)
61
+ guard-rspec (4.7.3)
62
+ guard (~> 2.1)
63
+ guard-compat (~> 1.1)
64
+ rspec (>= 2.99.0, < 4.0)
65
+ json (2.6.3)
66
+ kramdown (2.4.0)
67
+ rexml
68
+ kramdown-parser-gfm (1.1.0)
69
+ kramdown (~> 2.0)
70
+ language_server-protocol (3.17.0.3)
71
+ listen (3.8.0)
72
+ rb-fsevent (~> 0.10, >= 0.10.3)
73
+ rb-inotify (~> 0.9, >= 0.9.10)
74
+ lumberjack (1.2.9)
75
+ method_source (1.0.0)
76
+ nap (1.1.0)
77
+ nenv (0.3.0)
78
+ net-http (0.4.1)
79
+ uri
80
+ no_proxy_fix (0.1.2)
81
+ notiffany (0.1.3)
82
+ nenv (~> 0.1)
83
+ shellany (~> 0.0)
84
+ octokit (8.1.0)
85
+ base64
86
+ faraday (>= 1, < 3)
87
+ sawyer (~> 0.9)
88
+ open4 (1.3.4)
89
+ ox (2.14.18)
90
+ parallel (1.23.0)
91
+ parser (3.2.2.3)
92
+ ast (~> 2.4.1)
93
+ racc
94
+ pry (0.14.2)
95
+ coderay (~> 1.1)
96
+ method_source (~> 1.0)
97
+ public_suffix (5.0.5)
98
+ racc (1.7.1)
99
+ rainbow (3.1.1)
100
+ rake (13.0.6)
101
+ rb-fsevent (0.11.2)
102
+ rb-inotify (0.10.1)
103
+ ffi (~> 1.0)
104
+ rchardet (1.8.0)
105
+ regexp_parser (2.8.1)
106
+ rexml (3.2.5)
107
+ rspec (3.12.0)
108
+ rspec-core (~> 3.12.0)
109
+ rspec-expectations (~> 3.12.0)
110
+ rspec-mocks (~> 3.12.0)
111
+ rspec-core (3.12.2)
112
+ rspec-support (~> 3.12.0)
113
+ rspec-expectations (3.12.3)
114
+ diff-lcs (>= 1.2.0, < 2.0)
115
+ rspec-support (~> 3.12.0)
116
+ rspec-mocks (3.12.6)
117
+ diff-lcs (>= 1.2.0, < 2.0)
118
+ rspec-support (~> 3.12.0)
119
+ rspec-support (3.12.1)
120
+ rubocop (1.54.2)
121
+ json (~> 2.3)
122
+ language_server-protocol (>= 3.17.0)
123
+ parallel (~> 1.10)
124
+ parser (>= 3.2.2.3)
125
+ rainbow (>= 2.2.2, < 4.0)
126
+ regexp_parser (>= 1.8, < 3.0)
127
+ rexml (>= 3.2.5, < 4.0)
128
+ rubocop-ast (>= 1.28.0, < 2.0)
129
+ ruby-progressbar (~> 1.7)
130
+ unicode-display_width (>= 2.4.0, < 3.0)
131
+ rubocop-ast (1.29.0)
132
+ parser (>= 3.2.1.0)
133
+ ruby-progressbar (1.13.0)
134
+ sawyer (0.9.2)
135
+ addressable (>= 2.3.5)
136
+ faraday (>= 0.17.3, < 3)
137
+ shellany (0.0.1)
138
+ terminal-table (3.0.2)
139
+ unicode-display_width (>= 1.1.1, < 3)
140
+ thor (1.2.2)
141
+ unicode-display_width (2.4.2)
142
+ uri (0.13.0)
143
+ yard (0.9.34)
144
+
145
+ PLATFORMS
146
+ ruby
147
+ x64-mingw-ucrt
148
+
149
+ DEPENDENCIES
150
+ bundler (~> 2.4)
151
+ danger-checkstyle_xml!
152
+ guard (~> 2.18)
153
+ guard-rspec (~> 4.7)
154
+ listen (= 3.8)
155
+ pry
156
+ rake (~> 13.0)
157
+ rspec (~> 3.12)
158
+ rubocop (~> 1.54)
159
+ yard (~> 0.9)
160
+
161
+ BUNDLED WITH
162
+ 2.4.17
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.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2017 noboru-i <ishikura.noboru@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,49 @@
1
+ [![Build Status](https://travis-ci.org/noboru-i/danger-checkstyle_format.svg?branch=master)](https://travis-ci.org/noboru-i/danger-checkstyle_format)
2
+
3
+ # danger-checkstyle_format
4
+
5
+ Danger plugin for checkstyle formatted xml file.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ $ gem install danger-checkstyle_format
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ Parse an XML file, and let the plugin do your reporting:
16
+
17
+ ```ruby
18
+ checkstyle_format.base_path = Dir.pwd
19
+ checkstyle_format.report 'app/build/reports/checkstyle/checkstyle.xml'
20
+ ```
21
+
22
+ Parse some XML text, and let the plugin do your reporting:
23
+
24
+ ```ruby
25
+ checkstyle_format.base_path = Dir.pwd
26
+ checkstyle_format.report_by_text '<?xml ...'
27
+ ```
28
+
29
+ ## Development
30
+
31
+ 1. Clone this repo
32
+ 2. Run `bundle install` to setup dependencies.
33
+ 3. Run `bundle exec rake spec` to run the tests.
34
+ 4. Use `bundle exec guard` to automatically have tests run as you make changes.
35
+ 5. Make your changes.
36
+
37
+ ## Publishing
38
+
39
+ How to build a gem:
40
+
41
+ ```
42
+ gem build danger-checkstyle_xml.gemspec
43
+ ```
44
+
45
+ How to publish a gem:
46
+
47
+ ```
48
+ gem push danger-checkstyle_xml-VERSION.gem
49
+ ```
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,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ CheckstyleError = Struct.new(:file_name, :line, :column, :severity, :message, :source) do
4
+ def self.generate(node, parent_node, base_path)
5
+ CheckstyleError.new(
6
+ parent_node[:name].sub(/^#{base_path}/, ""),
7
+ node[:line].to_i,
8
+ node[:column]&.to_i,
9
+ node[:severity],
10
+ node[:message],
11
+ node[:source]
12
+ )
13
+ end
14
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CheckstyleFormat
4
+ VERSION = "0.0.1".freeze
5
+ end
@@ -0,0 +1,82 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "checkstyle_error"
4
+
5
+ module Danger
6
+ # Danger plugin for checkstyle xml files.
7
+ #
8
+ # @example Parse the XML file, and let the plugin do your reporting
9
+ #
10
+ # checkstyle_format.base_path = Dir.pwd
11
+ # checkstyle_format.report 'app/build/reports/checkstyle/checkstyle.xml'
12
+ #
13
+ # @example Parse the XML text, and let the plugin do your reporting
14
+ #
15
+ # checkstyle_format.base_path = Dir.pwd
16
+ # checkstyle_format.report_by_text '<?xml ...'
17
+ #
18
+ # @see noboru-i/danger-checkstyle_format
19
+ # @tags lint, reporting
20
+ #
21
+ class DangerCheckstyleFormat < Plugin
22
+ # Base path of `name` attributes in `file` tag.
23
+ # Defaults to nil.
24
+ # @return [String]
25
+ attr_accessor :base_path
26
+
27
+ # Report checkstyle warnings
28
+ #
29
+ # @return [void]
30
+ def report(file, inline_mode: true)
31
+ raise "Please specify file name." if file.empty?
32
+ raise "No checkstyle file was found at #{file}" unless File.exist? file
33
+
34
+ errors = parse(File.read(file))
35
+
36
+ send_comment(errors, inline_mode)
37
+ end
38
+
39
+ # Report checkstyle warnings by XML text
40
+ #
41
+ # @return [void]
42
+ def report_by_text(text, inline_mode: true)
43
+ raise "Please specify xml text." if text.empty?
44
+
45
+ errors = parse(text)
46
+
47
+ send_comment(errors, inline_mode)
48
+ end
49
+
50
+ private
51
+
52
+ def parse(text)
53
+ require "ox"
54
+
55
+ doc = Ox.parse(text)
56
+ present_elements = doc.nodes.first.nodes.reject do |test|
57
+ test.nodes.empty?
58
+ end
59
+ base_path_suffix = @base_path.end_with?("/") ? "" : "/"
60
+ base_path = @base_path + base_path_suffix
61
+ present_elements.flat_map do |parent|
62
+ parent.nodes.map do |child|
63
+ CheckstyleError.generate(child, parent, base_path)
64
+ end
65
+ end
66
+ end
67
+
68
+ def send_comment(errors, inline_mode)
69
+ if inline_mode
70
+ send_inline_comment(errors)
71
+ else
72
+ raise "not implemented." # TODO: not implemented.
73
+ end
74
+ end
75
+
76
+ def send_inline_comment(errors)
77
+ errors.each do |error|
78
+ warn(error.message, file: error.file_name, line: error.line)
79
+ end
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "checkstyle_format/gem_version"
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "checkstyle_format/plugin"
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path("spec_helper", __dir__)
4
+
5
+ module Danger
6
+ describe Danger::DangerCheckstyleFormat do
7
+ it "should be a plugin" do
8
+ expect(Danger::DangerCheckstyleFormat.new(nil)).to be_a Danger::Plugin
9
+ end
10
+
11
+ describe "with Dangerfile" do
12
+ before do
13
+ @dangerfile = testing_dangerfile
14
+ @checkstyle_format = @dangerfile.checkstyle_format
15
+ end
16
+
17
+ describe ".send_inline_comment" do
18
+ it "calls certain argument" do
19
+ errors = [
20
+ CheckstyleError.new("XXX.java", 1, nil, "error", "test message1.", "source"),
21
+ CheckstyleError.new("YYY.java", 2, nil, "error", "test message2.", "source")
22
+ ]
23
+ @checkstyle_format.send(:send_inline_comment, errors)
24
+ expect(@checkstyle_format.status_report[:warnings]).to eq(["test message1.", "test message2."])
25
+ expect(@checkstyle_format.violation_report[:warnings][0]).to eq(Violation.new("test message1.", false, "XXX.java", 1))
26
+ expect(@checkstyle_format.violation_report[:warnings][1]).to eq(Violation.new("test message2.", false, "YYY.java", 2))
27
+ end
28
+ end
29
+
30
+ describe ".parse" do
31
+ subject(:errors) do
32
+ @checkstyle_format.base_path = "/path/to"
33
+ @checkstyle_format.send(:parse, File.read("spec/fixtures/checkstyle.xml"))
34
+ end
35
+ it "have 4 items" do
36
+ expect(errors.size).to be 4
37
+ end
38
+
39
+ it "is mapped CheckstyleError about index is 0" do
40
+ expect(errors[0].file_name).to eq("XXX.java")
41
+ expect(errors[0].line).to eq(0)
42
+ expect(errors[0].column).to be_nil
43
+ expect(errors[0].severity).to eq("error")
44
+ expect(errors[0].message).to eq("File does not end with a newline.")
45
+ expect(errors[0].source).to eq("com.puppycrawl.tools.checkstyle.checks.NewlineAtEndOfFileCheck")
46
+ end
47
+
48
+ it "is mapped CheckstyleError about index is 2" do
49
+ expect(errors[2].file_name).to eq("YYY.java")
50
+ expect(errors[2].line).to eq(12)
51
+ expect(errors[2].column).to eq(13)
52
+ expect(errors[2].severity).to eq("error")
53
+ expect(errors[2].message).to eq("Name 'enableOcr' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.")
54
+ expect(errors[2].source).to eq("com.puppycrawl.tools.checkstyle.checks.naming.ConstantNameCheck")
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <checkstyle version="5.9">
3
+ <file name="/path/to/XXX.java">
4
+ <error line="0" severity="error" message="File does not end with a newline." source="com.puppycrawl.tools.checkstyle.checks.NewlineAtEndOfFileCheck"/>
5
+ </file>
6
+ <file name="/path/to/YYY.java">
7
+ <error line="9" severity="error" message="interfaces should describe a type and hence have methods." source="com.puppycrawl.tools.checkstyle.checks.design.InterfaceIsTypeCheck"/>
8
+ <error line="12" column="13" severity="error" message="Name &apos;enableOcr&apos; must match pattern &apos;^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$&apos;." source="com.puppycrawl.tools.checkstyle.checks.naming.ConstantNameCheck"/>
9
+ <error line="15" column="12" severity="error" message="Name &apos;selectedLanguage&apos; must match pattern &apos;^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$&apos;." source="com.puppycrawl.tools.checkstyle.checks.naming.ConstantNameCheck"/>
10
+ </file>
11
+ <file name="/path/to/ZZZ.java">
12
+ </file>
13
+ </checkstyle>
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "pathname"
4
+ ROOT = Pathname.new(File.expand_path("..", __dir__))
5
+ $:.unshift("#{ROOT}lib".to_s)
6
+ $:.unshift("#{ROOT}spec".to_s)
7
+
8
+ require "bundler/setup"
9
+ require "pry"
10
+
11
+ require "rspec"
12
+ require "danger"
13
+
14
+ if `git remote -v` == ""
15
+ puts "You cannot run tests without setting a local git remote on this repo"
16
+ puts "It's a weird side-effect of Danger's internals."
17
+ exit(0)
18
+ end
19
+
20
+ # Use coloured output, it's the best.
21
+ RSpec.configure do |config|
22
+ config.filter_gems_from_backtrace "bundler"
23
+ config.color = true
24
+ config.tty = true
25
+ end
26
+
27
+ require "danger_plugin"
28
+
29
+ # These functions are a subset of https://github.com/danger/danger/blob/master/spec/spec_helper.rb
30
+ # If you are expanding these files, see if it's already been done ^.
31
+
32
+ # A silent version of the user interface,
33
+ # it comes with an extra function `.string` which will
34
+ # strip all ANSI colours from the string.
35
+
36
+ # rubocop:disable Lint/NestedMethodDefinition
37
+ def testing_ui
38
+ @output = StringIO.new
39
+ def @output.winsize
40
+ [20, 9999]
41
+ end
42
+
43
+ cork = Cork::Board.new(out: @output)
44
+ def cork.string
45
+ out.string.gsub(/\e\[([;\d]+)?m/, "")
46
+ end
47
+ cork
48
+ end
49
+ # rubocop:enable Lint/NestedMethodDefinition
50
+
51
+ # Example environment (ENV) that would come from
52
+ # running a PR on TravisCI
53
+ def testing_env
54
+ {
55
+ "HAS_JOSH_K_SEAL_OF_APPROVAL" => "true",
56
+ "TRAVIS_PULL_REQUEST" => "800",
57
+ "TRAVIS_REPO_SLUG" => "artsy/eigen",
58
+ "TRAVIS_COMMIT_RANGE" => "759adcbd0d8f...13c4dc8bb61d",
59
+ "DANGER_GITHUB_API_TOKEN" => "123sbdq54erfsd3422gdfio"
60
+ }
61
+ end
62
+
63
+ # A stubbed out Dangerfile for use in tests
64
+ def testing_dangerfile
65
+ env = Danger::EnvironmentManager.new(testing_env)
66
+ Danger::Dangerfile.new(env, testing_ui)
67
+ end
metadata ADDED
@@ -0,0 +1,219 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: danger-checkstyle_xml
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - noboru-i
8
+ - JCarlosR
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2024-04-17 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: danger-plugin-api
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '1.0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '1.0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: ox
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '2.14'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '2.14'
42
+ - !ruby/object:Gem::Dependency
43
+ name: bundler
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '2.4'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '2.4'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rake
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '13.0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '13.0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: rspec
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '3.12'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '3.12'
84
+ - !ruby/object:Gem::Dependency
85
+ name: rubocop
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: '1.54'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: '1.54'
98
+ - !ruby/object:Gem::Dependency
99
+ name: yard
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - "~>"
103
+ - !ruby/object:Gem::Version
104
+ version: '0.9'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - "~>"
110
+ - !ruby/object:Gem::Version
111
+ version: '0.9'
112
+ - !ruby/object:Gem::Dependency
113
+ name: guard
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - "~>"
117
+ - !ruby/object:Gem::Version
118
+ version: '2.18'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - "~>"
124
+ - !ruby/object:Gem::Version
125
+ version: '2.18'
126
+ - !ruby/object:Gem::Dependency
127
+ name: guard-rspec
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - "~>"
131
+ - !ruby/object:Gem::Version
132
+ version: '4.7'
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - "~>"
138
+ - !ruby/object:Gem::Version
139
+ version: '4.7'
140
+ - !ruby/object:Gem::Dependency
141
+ name: listen
142
+ requirement: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - '='
145
+ - !ruby/object:Gem::Version
146
+ version: '3.8'
147
+ type: :development
148
+ prerelease: false
149
+ version_requirements: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - '='
152
+ - !ruby/object:Gem::Version
153
+ version: '3.8'
154
+ - !ruby/object:Gem::Dependency
155
+ name: pry
156
+ requirement: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ type: :development
162
+ prerelease: false
163
+ version_requirements: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ version: '0'
168
+ description: Danger plugin for checkstyle formatted xml file.
169
+ email:
170
+ - juancagb.17@gmail.com
171
+ executables: []
172
+ extensions: []
173
+ extra_rdoc_files: []
174
+ files:
175
+ - ".gitignore"
176
+ - ".rubocop.yml"
177
+ - ".ruby-version"
178
+ - ".travis.yml"
179
+ - Gemfile
180
+ - Gemfile.lock
181
+ - Guardfile
182
+ - LICENSE.txt
183
+ - README.md
184
+ - Rakefile
185
+ - lib/checkstyle_format/checkstyle_error.rb
186
+ - lib/checkstyle_format/gem_version.rb
187
+ - lib/checkstyle_format/plugin.rb
188
+ - lib/danger_checkstyle_format.rb
189
+ - lib/danger_plugin.rb
190
+ - spec/checkstyle_format_spec.rb
191
+ - spec/fixtures/checkstyle.xml
192
+ - spec/spec_helper.rb
193
+ homepage: https://github.com/JCarlosR/danger-checkstyle_format
194
+ licenses:
195
+ - MIT
196
+ metadata: {}
197
+ post_install_message:
198
+ rdoc_options: []
199
+ require_paths:
200
+ - lib
201
+ required_ruby_version: !ruby/object:Gem::Requirement
202
+ requirements:
203
+ - - ">="
204
+ - !ruby/object:Gem::Version
205
+ version: '0'
206
+ required_rubygems_version: !ruby/object:Gem::Requirement
207
+ requirements:
208
+ - - ">="
209
+ - !ruby/object:Gem::Version
210
+ version: '0'
211
+ requirements: []
212
+ rubygems_version: 3.4.19
213
+ signing_key:
214
+ specification_version: 4
215
+ summary: Danger plugin for checkstyle formatted xml file.
216
+ test_files:
217
+ - spec/checkstyle_format_spec.rb
218
+ - spec/fixtures/checkstyle.xml
219
+ - spec/spec_helper.rb