danger-codenarc 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/.rubocop.yml +161 -0
- data/.travis.yml +10 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +140 -0
- data/Guardfile +19 -0
- data/LICENSE.txt +22 -0
- data/README.md +23 -0
- data/Rakefile +23 -0
- data/danger-codenarc.gemspec +50 -0
- data/lib/codenarc/gem_version.rb +3 -0
- data/lib/codenarc/plugin.rb +86 -0
- data/lib/danger_codenarc.rb +1 -0
- data/lib/danger_plugin.rb +1 -0
- data/spec/codenarc_spec.rb +29 -0
- data/spec/spec_helper.rb +65 -0
- data/spec/support/example.xml +1892 -0
- metadata +218 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4e88816f6ce688a838c2c13ccc5c456f3331773f
|
4
|
+
data.tar.gz: dcec909eb520acc1ed0bff29072ea5a64f07791f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6dd392709068ebcc2790405a8a6872515242f214098767f3120b9e6b2c9048d43e78931490a79de74814974998765b2461a5c2061a86be3387391bbbbea84e19
|
7
|
+
data.tar.gz: 97242f735c15c753def94be1e536ea8722c55ebda7dd6a1e1c84a556caead76c79aacaf0ac8beab3ee97e14ee899b31bd5efaad2448fd2d3700d9b7dc9e4d18a
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,161 @@
|
|
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.3
|
7
|
+
|
8
|
+
Style/StringLiterals:
|
9
|
+
EnforcedStyle: double_quotes
|
10
|
+
Enabled: true
|
11
|
+
Exclude:
|
12
|
+
- '**/spec/**/*'
|
13
|
+
|
14
|
+
Style/FrozenStringLiteralComment:
|
15
|
+
Enabled: false
|
16
|
+
|
17
|
+
Style/ExpandPathArguments:
|
18
|
+
Exclude:
|
19
|
+
- '**/spec/**/*'
|
20
|
+
|
21
|
+
# kind_of? is a good way to check a type
|
22
|
+
Style/ClassCheck:
|
23
|
+
EnforcedStyle: kind_of?
|
24
|
+
|
25
|
+
# It's better to be more explicit about the type
|
26
|
+
Style/BracesAroundHashParameters:
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
# specs sometimes have useless assignments, which is fine
|
30
|
+
Lint/UselessAssignment:
|
31
|
+
Exclude:
|
32
|
+
- '**/spec/**/*'
|
33
|
+
|
34
|
+
# We could potentially enable the 2 below:
|
35
|
+
Layout/IndentHash:
|
36
|
+
Enabled: false
|
37
|
+
|
38
|
+
Layout/AlignHash:
|
39
|
+
Enabled: false
|
40
|
+
|
41
|
+
# HoundCI doesn't like this rule
|
42
|
+
Layout/DotPosition:
|
43
|
+
Enabled: false
|
44
|
+
|
45
|
+
# We allow !! as it's an easy way to convert ot boolean
|
46
|
+
Style/DoubleNegation:
|
47
|
+
Enabled: false
|
48
|
+
|
49
|
+
# Cop supports --auto-correct.
|
50
|
+
Lint/UnusedBlockArgument:
|
51
|
+
Enabled: false
|
52
|
+
|
53
|
+
# We want to allow class Fastlane::Class
|
54
|
+
Style/ClassAndModuleChildren:
|
55
|
+
Enabled: false
|
56
|
+
|
57
|
+
Metrics/AbcSize:
|
58
|
+
Max: 60
|
59
|
+
|
60
|
+
# The %w might be confusing for new users
|
61
|
+
Style/WordArray:
|
62
|
+
MinSize: 19
|
63
|
+
|
64
|
+
# raise and fail are both okay
|
65
|
+
Style/SignalException:
|
66
|
+
Enabled: false
|
67
|
+
|
68
|
+
# Better too much 'return' than one missing
|
69
|
+
Style/RedundantReturn:
|
70
|
+
Enabled: false
|
71
|
+
|
72
|
+
# Having if in the same line might not always be good
|
73
|
+
Style/IfUnlessModifier:
|
74
|
+
Enabled: false
|
75
|
+
|
76
|
+
# and and or is okay
|
77
|
+
Style/AndOr:
|
78
|
+
Enabled: false
|
79
|
+
|
80
|
+
# Configuration parameters: CountComments.
|
81
|
+
Metrics/ClassLength:
|
82
|
+
Max: 350
|
83
|
+
|
84
|
+
Metrics/CyclomaticComplexity:
|
85
|
+
Max: 17
|
86
|
+
|
87
|
+
# Configuration parameters: AllowURI, URISchemes.
|
88
|
+
Metrics/LineLength:
|
89
|
+
Max: 370
|
90
|
+
|
91
|
+
# Configuration parameters: CountKeywordArgs.
|
92
|
+
Metrics/ParameterLists:
|
93
|
+
Max: 10
|
94
|
+
|
95
|
+
Metrics/PerceivedComplexity:
|
96
|
+
Max: 18
|
97
|
+
|
98
|
+
# Sometimes it's easier to read without guards
|
99
|
+
Style/GuardClause:
|
100
|
+
Enabled: false
|
101
|
+
|
102
|
+
# something = if something_else
|
103
|
+
# that's confusing
|
104
|
+
Style/ConditionalAssignment:
|
105
|
+
Enabled: false
|
106
|
+
|
107
|
+
# Better to have too much self than missing a self
|
108
|
+
Style/RedundantSelf:
|
109
|
+
Enabled: false
|
110
|
+
|
111
|
+
Metrics/MethodLength:
|
112
|
+
Max: 60
|
113
|
+
|
114
|
+
# We're not there yet
|
115
|
+
Style/Documentation:
|
116
|
+
Enabled: false
|
117
|
+
|
118
|
+
# Adds complexity
|
119
|
+
Style/IfInsideElse:
|
120
|
+
Enabled: false
|
121
|
+
|
122
|
+
# danger specific
|
123
|
+
|
124
|
+
Style/BlockComments:
|
125
|
+
Enabled: false
|
126
|
+
|
127
|
+
Layout/MultilineMethodCallIndentation:
|
128
|
+
EnforcedStyle: indented
|
129
|
+
|
130
|
+
# FIXME: 25
|
131
|
+
Metrics/BlockLength:
|
132
|
+
Max: 345
|
133
|
+
Exclude:
|
134
|
+
- "**/*_spec.rb"
|
135
|
+
|
136
|
+
Style/MixinGrouping:
|
137
|
+
Enabled: false
|
138
|
+
|
139
|
+
Style/FileName:
|
140
|
+
Enabled: false
|
141
|
+
|
142
|
+
Layout/IndentHeredoc:
|
143
|
+
Enabled: false
|
144
|
+
|
145
|
+
Style/SpecialGlobalVars:
|
146
|
+
Enabled: false
|
147
|
+
|
148
|
+
PercentLiteralDelimiters:
|
149
|
+
PreferredDelimiters:
|
150
|
+
"%": ()
|
151
|
+
"%i": ()
|
152
|
+
"%q": ()
|
153
|
+
"%Q": ()
|
154
|
+
"%r": "{}"
|
155
|
+
"%s": ()
|
156
|
+
"%w": ()
|
157
|
+
"%W": ()
|
158
|
+
"%x": ()
|
159
|
+
|
160
|
+
Security/YAMLLoad:
|
161
|
+
Enabled: false
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
danger-codenarc (0.0.1)
|
5
|
+
danger-plugin-api (~> 1.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
addressable (2.5.2)
|
11
|
+
public_suffix (>= 2.0.2, < 4.0)
|
12
|
+
ast (2.4.0)
|
13
|
+
claide (1.0.2)
|
14
|
+
claide-plugins (0.9.2)
|
15
|
+
cork
|
16
|
+
nap
|
17
|
+
open4 (~> 1.3)
|
18
|
+
coderay (1.1.2)
|
19
|
+
colored2 (3.1.2)
|
20
|
+
cork (0.3.0)
|
21
|
+
colored2 (~> 3.1)
|
22
|
+
danger (5.11.1)
|
23
|
+
claide (~> 1.0)
|
24
|
+
claide-plugins (>= 0.9.2)
|
25
|
+
colored2 (~> 3.1)
|
26
|
+
cork (~> 0.1)
|
27
|
+
faraday (~> 0.9)
|
28
|
+
faraday-http-cache (~> 1.0)
|
29
|
+
git (~> 1.5)
|
30
|
+
kramdown (~> 1.5)
|
31
|
+
no_proxy_fix
|
32
|
+
octokit (~> 4.7)
|
33
|
+
terminal-table (~> 1)
|
34
|
+
danger-plugin-api (1.0.0)
|
35
|
+
danger (> 2.0)
|
36
|
+
diff-lcs (1.3)
|
37
|
+
faraday (0.15.4)
|
38
|
+
multipart-post (>= 1.2, < 3)
|
39
|
+
faraday-http-cache (1.3.1)
|
40
|
+
faraday (~> 0.8)
|
41
|
+
ffi (1.10.0)
|
42
|
+
formatador (0.2.5)
|
43
|
+
git (1.5.0)
|
44
|
+
guard (2.15.0)
|
45
|
+
formatador (>= 0.2.4)
|
46
|
+
listen (>= 2.7, < 4.0)
|
47
|
+
lumberjack (>= 1.0.12, < 2.0)
|
48
|
+
nenv (~> 0.1)
|
49
|
+
notiffany (~> 0.0)
|
50
|
+
pry (>= 0.9.12)
|
51
|
+
shellany (~> 0.0)
|
52
|
+
thor (>= 0.18.1)
|
53
|
+
guard-compat (1.2.1)
|
54
|
+
guard-rspec (4.7.3)
|
55
|
+
guard (~> 2.1)
|
56
|
+
guard-compat (~> 1.1)
|
57
|
+
rspec (>= 2.99.0, < 4.0)
|
58
|
+
jaro_winkler (1.5.2)
|
59
|
+
kramdown (1.17.0)
|
60
|
+
listen (3.0.7)
|
61
|
+
rb-fsevent (>= 0.9.3)
|
62
|
+
rb-inotify (>= 0.9.7)
|
63
|
+
lumberjack (1.0.13)
|
64
|
+
method_source (0.9.2)
|
65
|
+
mini_portile2 (2.4.0)
|
66
|
+
multipart-post (2.0.0)
|
67
|
+
nap (1.1.0)
|
68
|
+
nenv (0.3.0)
|
69
|
+
no_proxy_fix (0.1.2)
|
70
|
+
nokogiri (1.10.1)
|
71
|
+
mini_portile2 (~> 2.4.0)
|
72
|
+
notiffany (0.1.1)
|
73
|
+
nenv (~> 0.1)
|
74
|
+
shellany (~> 0.0)
|
75
|
+
octokit (4.13.0)
|
76
|
+
sawyer (~> 0.8.0, >= 0.5.3)
|
77
|
+
open4 (1.3.4)
|
78
|
+
parallel (1.13.0)
|
79
|
+
parser (2.6.0.0)
|
80
|
+
ast (~> 2.4.0)
|
81
|
+
powerpack (0.1.2)
|
82
|
+
pry (0.12.2)
|
83
|
+
coderay (~> 1.1.0)
|
84
|
+
method_source (~> 0.9.0)
|
85
|
+
public_suffix (3.0.3)
|
86
|
+
rainbow (3.0.0)
|
87
|
+
rake (10.5.0)
|
88
|
+
rb-fsevent (0.10.3)
|
89
|
+
rb-inotify (0.10.0)
|
90
|
+
ffi (~> 1.0)
|
91
|
+
rspec (3.8.0)
|
92
|
+
rspec-core (~> 3.8.0)
|
93
|
+
rspec-expectations (~> 3.8.0)
|
94
|
+
rspec-mocks (~> 3.8.0)
|
95
|
+
rspec-core (3.8.0)
|
96
|
+
rspec-support (~> 3.8.0)
|
97
|
+
rspec-expectations (3.8.2)
|
98
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
99
|
+
rspec-support (~> 3.8.0)
|
100
|
+
rspec-mocks (3.8.0)
|
101
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
102
|
+
rspec-support (~> 3.8.0)
|
103
|
+
rspec-support (3.8.0)
|
104
|
+
rubocop (0.63.0)
|
105
|
+
jaro_winkler (~> 1.5.1)
|
106
|
+
parallel (~> 1.10)
|
107
|
+
parser (>= 2.5, != 2.5.1.1)
|
108
|
+
powerpack (~> 0.1)
|
109
|
+
rainbow (>= 2.2.2, < 4.0)
|
110
|
+
ruby-progressbar (~> 1.7)
|
111
|
+
unicode-display_width (~> 1.4.0)
|
112
|
+
ruby-progressbar (1.10.0)
|
113
|
+
sawyer (0.8.1)
|
114
|
+
addressable (>= 2.3.5, < 2.6)
|
115
|
+
faraday (~> 0.8, < 1.0)
|
116
|
+
shellany (0.0.1)
|
117
|
+
terminal-table (1.8.0)
|
118
|
+
unicode-display_width (~> 1.1, >= 1.1.1)
|
119
|
+
thor (0.20.3)
|
120
|
+
unicode-display_width (1.4.1)
|
121
|
+
yard (0.9.16)
|
122
|
+
|
123
|
+
PLATFORMS
|
124
|
+
ruby
|
125
|
+
|
126
|
+
DEPENDENCIES
|
127
|
+
bundler (~> 1.3)
|
128
|
+
danger-codenarc!
|
129
|
+
guard (~> 2.14)
|
130
|
+
guard-rspec (~> 4.7)
|
131
|
+
listen (= 3.0.7)
|
132
|
+
nokogiri
|
133
|
+
pry
|
134
|
+
rake (~> 10.0)
|
135
|
+
rspec (~> 3.4)
|
136
|
+
rubocop
|
137
|
+
yard
|
138
|
+
|
139
|
+
BUNDLED WITH
|
140
|
+
1.16.1
|
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) 2019 Patrick Butkiewicz <patrick@intrepid.io>
|
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,23 @@
|
|
1
|
+
# danger-codenarc
|
2
|
+
|
3
|
+
A Danger plugin that shows the output generated by CodeNarc.
|
4
|
+
|
5
|
+
To use this plugin, you need to generate a xml report file using CodeNarc for this plugin to read. This plugin consolidates P2 and P3 CodeNarc violations into warnings, and P1 violations into errors. The CodeNarc package summary is also sent as a message by Danger.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
$ gem install danger-codenarc
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
Methods and attributes from this plugin are available in your `Dangerfile` under the `codenarc` namespace.
|
14
|
+
|
15
|
+
codenarc.report('CodeNarcXmlReport.xml')
|
16
|
+
|
17
|
+
## Development
|
18
|
+
|
19
|
+
1. Clone this repo
|
20
|
+
2. Run `bundle install` to setup dependencies.
|
21
|
+
3. Run `bundle exec rake spec` to run the tests.
|
22
|
+
4. Use `bundle exec guard` to automatically have tests run as you make changes.
|
23
|
+
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 'codenarc/gem_version.rb'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'danger-codenarc'
|
8
|
+
spec.version = Codenarc::VERSION
|
9
|
+
spec.authors = ['Patrick Butkiewicz']
|
10
|
+
spec.email = ['pat.butkiewicz@accenture.com']
|
11
|
+
spec.description = %q{Reads CodeNarc violations}
|
12
|
+
spec.summary = %q{Reads the report generated by CodeNarc and parses it to display}
|
13
|
+
spec.homepage = 'https://github.com/IntrepidPursuits/danger-codenarc'
|
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 'nokogiri'
|
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"
|
33
|
+
spec.add_development_dependency "yard"
|
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
|