danger-checkstyle_format 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: 1ddb72081274d10636f6d556a7fe7501da811b07
4
+ data.tar.gz: 1159684bfdadea14876e58bdcb0a821d567f6342
5
+ SHA512:
6
+ metadata.gz: 402f2c09db9fe9aff340eaa673de83064695f8eddc7679624c3859f5c9659850b21b0cd532e8a6b09486064e50173a638db09b3484efb37d91e6f0180c28bc58
7
+ data.tar.gz: c7bb3b01c6e03bc309077d88a820a051af9fbbdbad1da88564e90c0e10eac991ec7a3a0b9f75f45b9e294fd465d233888811e3f7e1e2f3203a45602e6846c775
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,152 @@
1
+ # Defaults can be found here: https://github.com/bbatsov/rubocop/blob/master/config/default.yml
2
+
3
+ # If you don't like these settings, just delete this file :)
4
+
5
+ AllCops:
6
+ TargetRubyVersion: 2.0
7
+
8
+ Style/StringLiterals:
9
+ EnforcedStyle: double_quotes
10
+ Enabled: true
11
+
12
+ # kind_of? is a good way to check a type
13
+ Style/ClassCheck:
14
+ EnforcedStyle: kind_of?
15
+
16
+ # It's better to be more explicit about the type
17
+ Style/BracesAroundHashParameters:
18
+ Enabled: false
19
+
20
+ # specs sometimes have useless assignments, which is fine
21
+ Lint/UselessAssignment:
22
+ Exclude:
23
+ - '**/spec/**/*'
24
+
25
+ # We could potentially enable the 2 below:
26
+ Layout/IndentHash:
27
+ Enabled: false
28
+
29
+ Layout/AlignHash:
30
+ Enabled: false
31
+
32
+ # HoundCI doesn't like this rule
33
+ Layout/DotPosition:
34
+ Enabled: false
35
+
36
+ # We allow !! as it's an easy way to convert ot boolean
37
+ Style/DoubleNegation:
38
+ Enabled: false
39
+
40
+ # Cop supports --auto-correct.
41
+ Lint/UnusedBlockArgument:
42
+ Enabled: false
43
+
44
+ # We want to allow class Fastlane::Class
45
+ Style/ClassAndModuleChildren:
46
+ Enabled: false
47
+
48
+ Metrics/AbcSize:
49
+ Max: 60
50
+
51
+ # The %w might be confusing for new users
52
+ Style/WordArray:
53
+ MinSize: 19
54
+
55
+ # raise and fail are both okay
56
+ Style/SignalException:
57
+ Enabled: false
58
+
59
+ # Better too much 'return' than one missing
60
+ Style/RedundantReturn:
61
+ Enabled: false
62
+
63
+ # Having if in the same line might not always be good
64
+ Style/IfUnlessModifier:
65
+ Enabled: false
66
+
67
+ # and and or is okay
68
+ Style/AndOr:
69
+ Enabled: false
70
+
71
+ # Configuration parameters: CountComments.
72
+ Metrics/ClassLength:
73
+ Max: 350
74
+
75
+ Metrics/CyclomaticComplexity:
76
+ Max: 17
77
+
78
+ # Configuration parameters: AllowURI, URISchemes.
79
+ Metrics/LineLength:
80
+ Max: 370
81
+
82
+ # Configuration parameters: CountKeywordArgs.
83
+ Metrics/ParameterLists:
84
+ Max: 10
85
+
86
+ Metrics/PerceivedComplexity:
87
+ Max: 18
88
+
89
+ # Sometimes it's easier to read without guards
90
+ Style/GuardClause:
91
+ Enabled: false
92
+
93
+ # something = if something_else
94
+ # that's confusing
95
+ Style/ConditionalAssignment:
96
+ Enabled: false
97
+
98
+ # Better to have too much self than missing a self
99
+ Style/RedundantSelf:
100
+ Enabled: false
101
+
102
+ Metrics/MethodLength:
103
+ Max: 60
104
+
105
+ # We're not there yet
106
+ Style/Documentation:
107
+ Enabled: false
108
+
109
+ # Adds complexity
110
+ Style/IfInsideElse:
111
+ Enabled: false
112
+
113
+ # danger specific
114
+
115
+ Style/BlockComments:
116
+ Enabled: false
117
+
118
+ Layout/MultilineMethodCallIndentation:
119
+ EnforcedStyle: indented
120
+
121
+ # FIXME: 25
122
+ Metrics/BlockLength:
123
+ Max: 345
124
+ Exclude:
125
+ - "**/*_spec.rb"
126
+
127
+ Style/MixinGrouping:
128
+ Enabled: false
129
+
130
+ Style/FileName:
131
+ Enabled: false
132
+
133
+ Layout/IndentHeredoc:
134
+ Enabled: false
135
+
136
+ Style/SpecialGlobalVars:
137
+ Enabled: false
138
+
139
+ PercentLiteralDelimiters:
140
+ PreferredDelimiters:
141
+ "%": ()
142
+ "%i": ()
143
+ "%q": ()
144
+ "%Q": ()
145
+ "%r": "{}"
146
+ "%s": ()
147
+ "%w": ()
148
+ "%W": ()
149
+ "%x": ()
150
+
151
+ Security/YAMLLoad:
152
+ Enabled: false
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,139 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ danger-checkstyle_format (0.0.1)
5
+ danger-plugin-api (~> 1.0)
6
+ ox (~> 2.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ addressable (2.5.2)
12
+ public_suffix (>= 2.0.2, < 4.0)
13
+ ast (2.3.0)
14
+ claide (1.0.2)
15
+ claide-plugins (0.9.2)
16
+ cork
17
+ nap
18
+ open4 (~> 1.3)
19
+ coderay (1.1.1)
20
+ colored2 (3.1.2)
21
+ cork (0.3.0)
22
+ colored2 (~> 3.1)
23
+ danger (5.3.5)
24
+ claide (~> 1.0)
25
+ claide-plugins (>= 0.9.2)
26
+ colored2 (~> 3.1)
27
+ cork (~> 0.1)
28
+ faraday (~> 0.9)
29
+ faraday-http-cache (~> 1.0)
30
+ git (~> 1)
31
+ kramdown (~> 1.5)
32
+ no_proxy_fix
33
+ octokit (~> 4.7)
34
+ terminal-table (~> 1)
35
+ danger-plugin-api (1.0.0)
36
+ danger (> 2.0)
37
+ diff-lcs (1.3)
38
+ faraday (0.13.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.14.0)
60
+ listen (3.0.7)
61
+ rb-fsevent (>= 0.9.3)
62
+ rb-inotify (>= 0.9.7)
63
+ lumberjack (1.0.12)
64
+ method_source (0.8.2)
65
+ multipart-post (2.0.0)
66
+ nap (1.1.0)
67
+ nenv (0.3.0)
68
+ no_proxy_fix (0.1.1)
69
+ notiffany (0.1.1)
70
+ nenv (~> 0.1)
71
+ shellany (~> 0.0)
72
+ octokit (4.7.0)
73
+ sawyer (~> 0.8.0, >= 0.5.3)
74
+ open4 (1.3.4)
75
+ ox (2.6.0)
76
+ parallel (1.12.0)
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 (3.0.0)
85
+ rainbow (2.2.2)
86
+ rake
87
+ rake (10.5.0)
88
+ rb-fsevent (0.10.2)
89
+ rb-inotify (0.9.10)
90
+ ffi (>= 0.5.0, < 2)
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.49.1)
105
+ parallel (~> 1.10)
106
+ parser (>= 2.3.3.1, < 3.0)
107
+ powerpack (~> 0.1)
108
+ rainbow (>= 1.99.1, < 3.0)
109
+ ruby-progressbar (~> 1.7)
110
+ unicode-display_width (~> 1.0, >= 1.0.1)
111
+ ruby-progressbar (1.8.1)
112
+ sawyer (0.8.1)
113
+ addressable (>= 2.3.5, < 2.6)
114
+ faraday (~> 0.8, < 1.0)
115
+ shellany (0.0.1)
116
+ slop (3.6.0)
117
+ terminal-table (1.8.0)
118
+ unicode-display_width (~> 1.1, >= 1.1.1)
119
+ thor (0.20.0)
120
+ unicode-display_width (1.3.0)
121
+ yard (0.9.9)
122
+
123
+ PLATFORMS
124
+ ruby
125
+
126
+ DEPENDENCIES
127
+ bundler (~> 1.3)
128
+ danger-checkstyle_format!
129
+ guard (~> 2.14)
130
+ guard-rspec (~> 4.7)
131
+ listen (= 3.0.7)
132
+ pry
133
+ rake (~> 10.0)
134
+ rspec (~> 3.4)
135
+ rubocop (~> 0.41)
136
+ yard (~> 0.8)
137
+
138
+ BUNDLED WITH
139
+ 1.15.4
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,24 @@
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
+ $ gem install danger-checkstyle_format
10
+
11
+ ## Usage
12
+
13
+ <blockquote>Parse the XML file, and let the plugin do your reporting
14
+ <pre>
15
+ checkstyle_format.report "/path/to/output.xml"</pre>
16
+ </blockquote>
17
+
18
+ ## Development
19
+
20
+ 1. Clone this repo
21
+ 2. Run `bundle install` to setup dependencies.
22
+ 3. Run `bundle exec rake spec` to run the tests.
23
+ 4. Use `bundle exec guard` to automatically have tests run as you make changes.
24
+ 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 'checkstyle_format/gem_version.rb'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'danger-checkstyle_format'
8
+ spec.version = CheckstyleFormat::VERSION
9
+ spec.authors = ['noboru-i']
10
+ spec.email = ['ishikura.noboru@gmail.com']
11
+ spec.description = %q{Danger plugin for checkstyle formatted xml file.}
12
+ spec.summary = %q{Danger plugin for checkstyle formatted xml file.}
13
+ spec.homepage = 'https://github.com/noboru-i/danger-checkstyle_format'
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 'ox', '~> 2.0'
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,3 @@
1
+ module CheckstyleFormat
2
+ VERSION = "0.0.1".freeze
3
+ end
@@ -0,0 +1,71 @@
1
+ module Danger
2
+ # Danger plugin for checkstyle formatted xml file.
3
+ #
4
+ # @example Parse the XML file, and let the plugin do your reporting
5
+ #
6
+ # checkstyle_format.report
7
+ #
8
+ # @see noboru-i/danger-checkstyle_format
9
+ # @tags lint, reporting
10
+ #
11
+ class DangerCheckstyleFormat < Plugin
12
+ # Base path of `name` attributes in `file` tag.
13
+ # Defaults to nil.
14
+ # @return [String]
15
+ attr_accessor :base_path
16
+
17
+ # Report checkstyle warnings
18
+ # @return [void]
19
+ #
20
+ def report(file, inline_mode = true)
21
+ raise "Please specify file name." if file.empty?
22
+ raise "No checkstyle file was found at #{file}" unless File.exist? file
23
+ errors = parse(file)
24
+
25
+ puts errors.size
26
+
27
+ if inline_mode
28
+ send_inline_comment(errors)
29
+ else
30
+ raise "not implemented." # TODO: not implemented.
31
+ end
32
+ end
33
+
34
+ CheckstyleError = Struct.new(:file_name, :line, :column, :severity, :message, :source) do
35
+ def self.generate(node, parent_node, base_path)
36
+ CheckstyleError.new(
37
+ parent_node[:name].sub(/^#{base_path}/, ""),
38
+ node[:line].to_i,
39
+ node[:column].nil? ? nil : node[:column].to_i,
40
+ node[:severity],
41
+ node[:message],
42
+ node[:source]
43
+ )
44
+ end
45
+ end
46
+
47
+ private
48
+
49
+ def parse(file)
50
+ require "ox"
51
+
52
+ doc = Ox.parse(File.read(file))
53
+ present_elements = doc.nodes.first.nodes.reject do |test|
54
+ test.nodes.empty?
55
+ end
56
+ elements = present_elements.flat_map do |parent|
57
+ parent.nodes.map do |child|
58
+ CheckstyleError.generate(child, parent, @base_path)
59
+ end
60
+ end
61
+
62
+ elements
63
+ end
64
+
65
+ def send_inline_comment(errors)
66
+ errors.each do |error|
67
+ warn(error.message, file: error.file_name, line: error.line)
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1 @@
1
+ require "checkstyle_format/gem_version"
@@ -0,0 +1 @@
1
+ require "checkstyle_format/plugin"
@@ -0,0 +1,57 @@
1
+ require File.expand_path("../spec_helper", __FILE__)
2
+
3
+ module Danger
4
+ describe Danger::DangerCheckstyleFormat do
5
+ it "should be a plugin" do
6
+ expect(Danger::DangerCheckstyleFormat.new(nil)).to be_a Danger::Plugin
7
+ end
8
+
9
+ describe "with Dangerfile" do
10
+ before do
11
+ @dangerfile = testing_dangerfile
12
+ @checkstyle_format = @dangerfile.checkstyle_format
13
+ end
14
+
15
+ describe ".send_inline_comment" do
16
+ it "calls certain argument" do
17
+ errors = [
18
+ DangerCheckstyleFormat::CheckstyleError.new("XXX.java", 1, nil, "error", "test message1.", "source"),
19
+ DangerCheckstyleFormat::CheckstyleError.new("YYY.java", 2, nil, "error", "test message2.", "source")
20
+ ]
21
+ @checkstyle_format.send(:send_inline_comment, errors)
22
+ expect(@checkstyle_format.status_report[:warnings]).to eq(["test message1.", "test message2."])
23
+ expect(@checkstyle_format.violation_report[:warnings][0]).to eq(Violation.new("test message1.", false, "XXX.java", 1))
24
+ expect(@checkstyle_format.violation_report[:warnings][1]).to eq(Violation.new("test message2.", false, "YYY.java", 2))
25
+ end
26
+ end
27
+
28
+ describe ".parse" do
29
+ subject(:errors) do
30
+ @checkstyle_format.base_path = "/path/to/"
31
+ @checkstyle_format.send(:parse, "spec/fixtures/checkstyle.xml")
32
+ end
33
+ it "have 4 items" do
34
+ expect(errors.size).to be 4
35
+ end
36
+
37
+ it "is mapped CheckstyleError about index is 0" do
38
+ expect(errors[0].file_name).to eq("XXX.java")
39
+ expect(errors[0].line).to eq(0)
40
+ expect(errors[0].column).to be_nil
41
+ expect(errors[0].severity).to eq("error")
42
+ expect(errors[0].message).to eq("File does not end with a newline.")
43
+ expect(errors[0].source).to eq("com.puppycrawl.tools.checkstyle.checks.NewlineAtEndOfFileCheck")
44
+ end
45
+
46
+ it "is mapped CheckstyleError about index is 2" do
47
+ expect(errors[2].file_name).to eq("YYY.java")
48
+ expect(errors[2].line).to eq(12)
49
+ expect(errors[2].column).to eq(13)
50
+ expect(errors[2].severity).to eq("error")
51
+ expect(errors[2].message).to eq("Name 'enableOcr' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.")
52
+ expect(errors[2].source).to eq("com.puppycrawl.tools.checkstyle.checks.naming.ConstantNameCheck")
53
+ end
54
+ end
55
+ end
56
+ end
57
+ 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,65 @@
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
+ if `git remote -v` == ""
13
+ puts "You cannot run tests without setting a local git remote on this repo"
14
+ puts "It's a weird side-effect of Danger's internals."
15
+ exit(0)
16
+ end
17
+
18
+ # Use coloured output, it's the best.
19
+ RSpec.configure do |config|
20
+ config.filter_gems_from_backtrace "bundler"
21
+ config.color = true
22
+ config.tty = true
23
+ end
24
+
25
+ require "danger_plugin"
26
+
27
+ # These functions are a subset of https://github.com/danger/danger/blob/master/spec/spec_helper.rb
28
+ # If you are expanding these files, see if it's already been done ^.
29
+
30
+ # A silent version of the user interface,
31
+ # it comes with an extra function `.string` which will
32
+ # strip all ANSI colours from the string.
33
+
34
+ # rubocop:disable Lint/NestedMethodDefinition
35
+ def testing_ui
36
+ @output = StringIO.new
37
+ def @output.winsize
38
+ [20, 9999]
39
+ end
40
+
41
+ cork = Cork::Board.new(out: @output)
42
+ def cork.string
43
+ out.string.gsub(/\e\[([;\d]+)?m/, "")
44
+ end
45
+ cork
46
+ end
47
+ # rubocop:enable Lint/NestedMethodDefinition
48
+
49
+ # Example environment (ENV) that would come from
50
+ # running a PR on TravisCI
51
+ def testing_env
52
+ {
53
+ "HAS_JOSH_K_SEAL_OF_APPROVAL" => "true",
54
+ "TRAVIS_PULL_REQUEST" => "800",
55
+ "TRAVIS_REPO_SLUG" => "artsy/eigen",
56
+ "TRAVIS_COMMIT_RANGE" => "759adcbd0d8f...13c4dc8bb61d",
57
+ "DANGER_GITHUB_API_TOKEN" => "123sbdq54erfsd3422gdfio"
58
+ }
59
+ end
60
+
61
+ # A stubbed out Dangerfile for use in tests
62
+ def testing_dangerfile
63
+ env = Danger::EnvironmentManager.new(testing_env)
64
+ Danger::Dangerfile.new(env, testing_ui)
65
+ end
metadata ADDED
@@ -0,0 +1,218 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: danger-checkstyle_format
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - noboru-i
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-08-31 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: ox
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
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: Danger plugin for checkstyle formatted xml file.
168
+ email:
169
+ - ishikura.noboru@gmail.com
170
+ executables: []
171
+ extensions: []
172
+ extra_rdoc_files: []
173
+ files:
174
+ - ".gitignore"
175
+ - ".rubocop.yml"
176
+ - ".travis.yml"
177
+ - Gemfile
178
+ - Gemfile.lock
179
+ - Guardfile
180
+ - LICENSE.txt
181
+ - README.md
182
+ - Rakefile
183
+ - danger-checkstyle_format.gemspec
184
+ - lib/checkstyle_format/gem_version.rb
185
+ - lib/checkstyle_format/plugin.rb
186
+ - lib/danger_checkstyle_format.rb
187
+ - lib/danger_plugin.rb
188
+ - spec/checkstyle_format_spec.rb
189
+ - spec/fixtures/checkstyle.xml
190
+ - spec/spec_helper.rb
191
+ homepage: https://github.com/noboru-i/danger-checkstyle_format
192
+ licenses:
193
+ - MIT
194
+ metadata: {}
195
+ post_install_message:
196
+ rdoc_options: []
197
+ require_paths:
198
+ - lib
199
+ required_ruby_version: !ruby/object:Gem::Requirement
200
+ requirements:
201
+ - - ">="
202
+ - !ruby/object:Gem::Version
203
+ version: '0'
204
+ required_rubygems_version: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
209
+ requirements: []
210
+ rubyforge_project:
211
+ rubygems_version: 2.6.11
212
+ signing_key:
213
+ specification_version: 4
214
+ summary: Danger plugin for checkstyle formatted xml file.
215
+ test_files:
216
+ - spec/checkstyle_format_spec.rb
217
+ - spec/fixtures/checkstyle.xml
218
+ - spec/spec_helper.rb