danger-rubocop 0.1.0
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 +7 -0
- data/.gitignore +50 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +127 -0
- data/Guardfile +21 -0
- data/LICENSE +21 -0
- data/README.md +36 -0
- data/Rakefile +13 -0
- data/danger-rubocop.gemspec +43 -0
- data/lib/danger_plugin.rb +44 -0
- data/lib/version.rb +3 -0
- data/spec/danger_plugin_spec.rb +62 -0
- data/spec/fixtures/ruby_file.rb +1 -0
- data/spec/spec_helper.rb +44 -0
- metadata +186 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 1515e5372954585820a9828937bbe1e1a8ca0470
|
|
4
|
+
data.tar.gz: 6f22b296591432eb9c56b6b051b79a562be4be14
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 4de4b1c3f7c5a1c9251f0df992510fceecfbe7aba0488ba47d8b4a714ca7bf9b58a4f97ec83f7b283619dada7975ba8ec2939cdea5e6d4b8c3d91a51198d6e87
|
|
7
|
+
data.tar.gz: 9d3bd307bbefd545498b37b8cacae97427b55a6b7e90e09d8d46c451bebc4fd813cca090e8682e4adbcb8cfca5157357f99c5b674c3eafea98a80cff0eb9570a
|
data/.gitignore
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
*.gem
|
|
2
|
+
*.rbc
|
|
3
|
+
/.config
|
|
4
|
+
/coverage/
|
|
5
|
+
/InstalledFiles
|
|
6
|
+
/pkg/
|
|
7
|
+
/spec/reports/
|
|
8
|
+
/spec/examples.txt
|
|
9
|
+
/test/tmp/
|
|
10
|
+
/test/version_tmp/
|
|
11
|
+
/tmp/
|
|
12
|
+
|
|
13
|
+
# Used by dotenv library to load environment variables.
|
|
14
|
+
# .env
|
|
15
|
+
|
|
16
|
+
## Specific to RubyMotion:
|
|
17
|
+
.dat*
|
|
18
|
+
.repl_history
|
|
19
|
+
build/
|
|
20
|
+
*.bridgesupport
|
|
21
|
+
build-iPhoneOS/
|
|
22
|
+
build-iPhoneSimulator/
|
|
23
|
+
|
|
24
|
+
## Specific to RubyMotion (use of CocoaPods):
|
|
25
|
+
#
|
|
26
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
|
27
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
|
28
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
|
29
|
+
#
|
|
30
|
+
# vendor/Pods/
|
|
31
|
+
|
|
32
|
+
## Documentation cache and generated files:
|
|
33
|
+
/.yardoc/
|
|
34
|
+
/_yardoc/
|
|
35
|
+
/doc/
|
|
36
|
+
/rdoc/
|
|
37
|
+
|
|
38
|
+
## Environment normalization:
|
|
39
|
+
/.bundle/
|
|
40
|
+
/vendor/bundle
|
|
41
|
+
/lib/bundler/man/
|
|
42
|
+
|
|
43
|
+
# for a library or gem, you might want to ignore these files since the code is
|
|
44
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
45
|
+
# Gemfile.lock
|
|
46
|
+
# .ruby-version
|
|
47
|
+
# .ruby-gemset
|
|
48
|
+
|
|
49
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
|
50
|
+
.rvmrc
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
danger-rubocop (0.0.1)
|
|
5
|
+
danger
|
|
6
|
+
rubocop
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: https://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
addressable (2.4.0)
|
|
12
|
+
ast (2.3.0)
|
|
13
|
+
bacon (1.2.0)
|
|
14
|
+
claide (1.0.0)
|
|
15
|
+
coderay (1.1.1)
|
|
16
|
+
colored (1.2)
|
|
17
|
+
cork (0.1.0)
|
|
18
|
+
colored (~> 1.2)
|
|
19
|
+
danger (0.8.3)
|
|
20
|
+
claide (~> 1.0)
|
|
21
|
+
colored (~> 1.2)
|
|
22
|
+
cork (~> 0.1)
|
|
23
|
+
faraday (~> 0)
|
|
24
|
+
git (~> 1)
|
|
25
|
+
octokit (~> 4.2)
|
|
26
|
+
redcarpet (~> 3.3)
|
|
27
|
+
terminal-table (~> 1)
|
|
28
|
+
diff-lcs (1.2.5)
|
|
29
|
+
faraday (0.9.2)
|
|
30
|
+
multipart-post (>= 1.2, < 3)
|
|
31
|
+
ffi (1.9.10)
|
|
32
|
+
formatador (0.2.5)
|
|
33
|
+
git (1.3.0)
|
|
34
|
+
guard (2.14.0)
|
|
35
|
+
formatador (>= 0.2.4)
|
|
36
|
+
listen (>= 2.7, < 4.0)
|
|
37
|
+
lumberjack (~> 1.0)
|
|
38
|
+
nenv (~> 0.1)
|
|
39
|
+
notiffany (~> 0.0)
|
|
40
|
+
pry (>= 0.9.12)
|
|
41
|
+
shellany (~> 0.0)
|
|
42
|
+
thor (>= 0.18.1)
|
|
43
|
+
guard-compat (1.2.1)
|
|
44
|
+
guard-rspec (4.7.2)
|
|
45
|
+
guard (~> 2.1)
|
|
46
|
+
guard-compat (~> 1.1)
|
|
47
|
+
rspec (>= 2.99.0, < 4.0)
|
|
48
|
+
listen (3.0.7)
|
|
49
|
+
rb-fsevent (>= 0.9.3)
|
|
50
|
+
rb-inotify (>= 0.9.7)
|
|
51
|
+
lumberjack (1.0.10)
|
|
52
|
+
metaclass (0.0.4)
|
|
53
|
+
method_source (0.8.2)
|
|
54
|
+
mocha (1.1.0)
|
|
55
|
+
metaclass (~> 0.0.1)
|
|
56
|
+
mocha-on-bacon (0.2.2)
|
|
57
|
+
mocha (>= 0.13.0)
|
|
58
|
+
multipart-post (2.0.0)
|
|
59
|
+
nenv (0.3.0)
|
|
60
|
+
notiffany (0.1.0)
|
|
61
|
+
nenv (~> 0.1)
|
|
62
|
+
shellany (~> 0.0)
|
|
63
|
+
octokit (4.3.0)
|
|
64
|
+
sawyer (~> 0.7.0, >= 0.5.3)
|
|
65
|
+
parser (2.3.1.2)
|
|
66
|
+
ast (~> 2.2)
|
|
67
|
+
powerpack (0.1.1)
|
|
68
|
+
prettybacon (0.0.2)
|
|
69
|
+
bacon (~> 1.2)
|
|
70
|
+
pry (0.10.3)
|
|
71
|
+
coderay (~> 1.1.0)
|
|
72
|
+
method_source (~> 0.8.1)
|
|
73
|
+
slop (~> 3.4)
|
|
74
|
+
rainbow (2.1.0)
|
|
75
|
+
rake (10.5.0)
|
|
76
|
+
rb-fsevent (0.9.7)
|
|
77
|
+
rb-inotify (0.9.7)
|
|
78
|
+
ffi (>= 0.5.0)
|
|
79
|
+
redcarpet (3.3.4)
|
|
80
|
+
rspec (3.4.0)
|
|
81
|
+
rspec-core (~> 3.4.0)
|
|
82
|
+
rspec-expectations (~> 3.4.0)
|
|
83
|
+
rspec-mocks (~> 3.4.0)
|
|
84
|
+
rspec-core (3.4.4)
|
|
85
|
+
rspec-support (~> 3.4.0)
|
|
86
|
+
rspec-expectations (3.4.0)
|
|
87
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
88
|
+
rspec-support (~> 3.4.0)
|
|
89
|
+
rspec-mocks (3.4.1)
|
|
90
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
91
|
+
rspec-support (~> 3.4.0)
|
|
92
|
+
rspec-support (3.4.1)
|
|
93
|
+
rubocop (0.41.1)
|
|
94
|
+
parser (>= 2.3.1.1, < 3.0)
|
|
95
|
+
powerpack (~> 0.1)
|
|
96
|
+
rainbow (>= 1.99.1, < 3.0)
|
|
97
|
+
ruby-progressbar (~> 1.7)
|
|
98
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
|
99
|
+
ruby-progressbar (1.8.1)
|
|
100
|
+
sawyer (0.7.0)
|
|
101
|
+
addressable (>= 2.3.5, < 2.5)
|
|
102
|
+
faraday (~> 0.8, < 0.10)
|
|
103
|
+
shellany (0.0.1)
|
|
104
|
+
slop (3.6.0)
|
|
105
|
+
terminal-table (1.6.0)
|
|
106
|
+
thor (0.19.1)
|
|
107
|
+
unicode-display_width (1.1.0)
|
|
108
|
+
|
|
109
|
+
PLATFORMS
|
|
110
|
+
ruby
|
|
111
|
+
|
|
112
|
+
DEPENDENCIES
|
|
113
|
+
bacon
|
|
114
|
+
bundler (~> 1.3)
|
|
115
|
+
danger-rubocop!
|
|
116
|
+
guard (~> 2.14)
|
|
117
|
+
guard-rspec (~> 4.7)
|
|
118
|
+
listen (= 3.0.7)
|
|
119
|
+
mocha
|
|
120
|
+
mocha-on-bacon
|
|
121
|
+
prettybacon
|
|
122
|
+
pry
|
|
123
|
+
rake (~> 10.0)
|
|
124
|
+
rspec (~> 3.4)
|
|
125
|
+
|
|
126
|
+
BUNDLED WITH
|
|
127
|
+
1.12.5
|
data/Guardfile
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
# Feel free to open issues for suggestions and improvements
|
|
11
|
+
|
|
12
|
+
# RSpec files
|
|
13
|
+
rspec = dsl.rspec
|
|
14
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
|
15
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
|
16
|
+
watch(rspec.spec_files)
|
|
17
|
+
|
|
18
|
+
# Ruby files
|
|
19
|
+
ruby = dsl.ruby
|
|
20
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
|
21
|
+
end
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 Ash Furrow
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
[](https://circleci.com/gh/ashfurrow/danger-rubocop)
|
|
2
|
+
|
|
3
|
+
# Danger Rubocop
|
|
4
|
+
|
|
5
|
+
A [Danger](https://github.com/danger/danger) plugin for [Rubocop](https://github.com/bbatsov/rubocop).
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Add this line to your Gemfile:
|
|
10
|
+
|
|
11
|
+
```rb
|
|
12
|
+
gem 'danger-rubocop'
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
The easiest way to use is just add this to your Dangerfile:
|
|
18
|
+
|
|
19
|
+
```rb
|
|
20
|
+
rubocop.run
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
That will lint any changed or added Ruby files in the PR.
|
|
24
|
+
|
|
25
|
+
You can also provide a list of files manually:
|
|
26
|
+
|
|
27
|
+
```rb
|
|
28
|
+
# Look through all changed Markdown files
|
|
29
|
+
rb_files = (modified_files + added_files).select { |f| f.end_with?(".rb") }
|
|
30
|
+
|
|
31
|
+
rubocop.run rb_files
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## License
|
|
35
|
+
|
|
36
|
+
MIT
|
data/Rakefile
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = 'danger-rubocop'
|
|
8
|
+
spec.version = DangerRubocop::VERSION
|
|
9
|
+
spec.authors = ['Ash Furrow']
|
|
10
|
+
spec.email = ['ash@ashfurrow.com']
|
|
11
|
+
spec.description = %q{A Danger plugin for running Ruby files through Rubocop.}
|
|
12
|
+
spec.summary = %q{A Danger plugin for running Ruby files through Rubocop.}
|
|
13
|
+
spec.homepage = 'https://github.com/ashfurrow/danger-rubocop'
|
|
14
|
+
spec.license = 'MIT'
|
|
15
|
+
|
|
16
|
+
spec.files = `git ls-files`.split($/)
|
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
18
|
+
spec.require_paths = ['lib']
|
|
19
|
+
|
|
20
|
+
spec.add_dependency 'danger'
|
|
21
|
+
spec.add_dependency 'rubocop'
|
|
22
|
+
|
|
23
|
+
# General ruby development
|
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
|
25
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
|
26
|
+
|
|
27
|
+
# Testing support
|
|
28
|
+
spec.add_development_dependency "rspec", '~> 3.4'
|
|
29
|
+
|
|
30
|
+
# Makes testing easy via `bundle exec guard`
|
|
31
|
+
spec.add_development_dependency "guard", '~> 2.14'
|
|
32
|
+
spec.add_development_dependency "guard-rspec", '~> 4.7'
|
|
33
|
+
|
|
34
|
+
# If you want to work on older builds of ruby
|
|
35
|
+
spec.add_development_dependency "listen", '3.0.7'
|
|
36
|
+
|
|
37
|
+
# This gives you the chance to run a REPL inside your test
|
|
38
|
+
# via
|
|
39
|
+
# binding.pry
|
|
40
|
+
# This will stop test execution and let you inspect the results
|
|
41
|
+
spec.add_development_dependency "pry"
|
|
42
|
+
|
|
43
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
module Danger
|
|
2
|
+
|
|
3
|
+
# Run Ruby files through Rubocop.
|
|
4
|
+
# Results are passed out as a table in markdown.
|
|
5
|
+
#
|
|
6
|
+
# @example Specifying custom config file.
|
|
7
|
+
#
|
|
8
|
+
# rubocop.run
|
|
9
|
+
#
|
|
10
|
+
# @see Moya/Aeryn
|
|
11
|
+
# @tags ruby, rubocop, linter
|
|
12
|
+
#
|
|
13
|
+
class DangerRubocop < Plugin
|
|
14
|
+
|
|
15
|
+
# Runs Ruby files through Rubocop. Generates a `markdown` list of warnings.
|
|
16
|
+
#
|
|
17
|
+
# @param [String] files
|
|
18
|
+
# A globbed string which should return the files that you want to
|
|
19
|
+
# run through, defaults to nil. If nil, modified and added files
|
|
20
|
+
# from the diff will be used.
|
|
21
|
+
# @return [void]
|
|
22
|
+
#
|
|
23
|
+
def run(files=nil)
|
|
24
|
+
files_to_lint = files ? Dir.glob(files) : (modified_files + added_files)
|
|
25
|
+
files_to_lint.select! { |f| f.end_with? 'rb' }
|
|
26
|
+
rubocop_results = files_to_lint.map { |f| JSON.parse(`bundle exec rubocop -f json #{f}`)['files'] }.flatten
|
|
27
|
+
offending_files = rubocop_results.select { |f| f['offenses'].count > 0 }
|
|
28
|
+
|
|
29
|
+
return if offending_files.empty?
|
|
30
|
+
|
|
31
|
+
message = '### Rubocop violations'
|
|
32
|
+
message << 'File | Line | Reason |\n'
|
|
33
|
+
message << '| --- | ----- | ----- |\n'
|
|
34
|
+
|
|
35
|
+
offending_files.each do |f|
|
|
36
|
+
f['offenses'].each do |o|
|
|
37
|
+
message << "#{f['path']} | #{o['location']['line']} | #{o['message']} \n"
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
markdown message
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
data/lib/version.rb
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
require File.expand_path('../spec_helper', __FILE__)
|
|
2
|
+
|
|
3
|
+
module Danger
|
|
4
|
+
describe DangerRubocop do
|
|
5
|
+
it 'is a plugin' do
|
|
6
|
+
expect(Danger::DangerRubocop < Danger::Plugin).to be_truthy
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe 'with Dangerfile' do
|
|
10
|
+
before do
|
|
11
|
+
@dangerfile = testing_dangerfile
|
|
12
|
+
@rubocop = testing_dangerfile.rubocop
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
describe :lint_files do
|
|
16
|
+
before do
|
|
17
|
+
# Set up our stubbed JSON response
|
|
18
|
+
response = {
|
|
19
|
+
"files" => [
|
|
20
|
+
{
|
|
21
|
+
"path": "ruby_file.rb",
|
|
22
|
+
"offenses" => [
|
|
23
|
+
{
|
|
24
|
+
"message" => "Don't do that!",
|
|
25
|
+
"location" => {"line": 13}
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
@rubocop_response = response.to_json
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it 'handles a known rubocop report' do
|
|
35
|
+
allow(@rubocop).to receive(:`).with('bundle exec rubocop -f json spec/fixtures/ruby_file.rb').and_return(@rubocop_response)
|
|
36
|
+
|
|
37
|
+
# Do it
|
|
38
|
+
@rubocop.run("spec/fixtures/*.rb")
|
|
39
|
+
|
|
40
|
+
output = @rubocop.status_report[:markdowns].first
|
|
41
|
+
|
|
42
|
+
expect(output).to_not be_empty
|
|
43
|
+
|
|
44
|
+
# A title
|
|
45
|
+
expect(output).to include("Rubocop violations")
|
|
46
|
+
# A warning
|
|
47
|
+
expect(output).to include("ruby_file.rb | 13 | Don't do that!")
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it 'handles no files' do
|
|
51
|
+
allow(@rubocop).to receive(:modified_files).and_return(['spec/fixtures/ruby_file.rb'])
|
|
52
|
+
allow(@rubocop).to receive(:added_files).and_return([])
|
|
53
|
+
allow(@rubocop).to receive(:`).with('bundle exec rubocop -f json spec/fixtures/ruby_file.rb').and_return(@rubocop_response)
|
|
54
|
+
|
|
55
|
+
@rubocop.run
|
|
56
|
+
|
|
57
|
+
expect(@rubocop.status_report[:markdowns].first).to_not be_empty
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# This file intentional left blank-ish.
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
require 'pathname'
|
|
2
|
+
|
|
3
|
+
ROOT = Pathname.new(File.expand_path('../../', __FILE__))
|
|
4
|
+
$:.unshift((ROOT + 'lib').to_s)
|
|
5
|
+
$:.unshift((ROOT + 'spec').to_s)
|
|
6
|
+
|
|
7
|
+
RSpec.configure do |config|
|
|
8
|
+
# Use color in STDOUT
|
|
9
|
+
config.color = true
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
require 'bundler/setup'
|
|
13
|
+
require 'pry'
|
|
14
|
+
|
|
15
|
+
require 'danger'
|
|
16
|
+
require 'cork'
|
|
17
|
+
require 'danger_plugin'
|
|
18
|
+
require 'json'
|
|
19
|
+
|
|
20
|
+
# These functions are a subset of https://github.com/danger/danger/blob/master/spec/spec_helper.rb
|
|
21
|
+
# If you are expanding these files, see if it's already been done ^.
|
|
22
|
+
|
|
23
|
+
# A silent version of the user interface
|
|
24
|
+
def testing_ui
|
|
25
|
+
Cork::Board.new(silent: true)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Example environment (ENV) that would come from
|
|
29
|
+
# running a PR on TravisCI
|
|
30
|
+
def testing_env
|
|
31
|
+
{
|
|
32
|
+
"HAS_JOSH_K_SEAL_OF_APPROVAL" => "true",
|
|
33
|
+
"TRAVIS_PULL_REQUEST" => "800",
|
|
34
|
+
"TRAVIS_REPO_SLUG" => "artsy/eigen",
|
|
35
|
+
"TRAVIS_COMMIT_RANGE" => "759adcbd0d8f...13c4dc8bb61d",
|
|
36
|
+
"DANGER_GITHUB_API_TOKEN" => "123sbdq54erfsd3422gdfio"
|
|
37
|
+
}
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# A stubbed out Dangerfile for use in tests
|
|
41
|
+
def testing_dangerfile
|
|
42
|
+
env = Danger::EnvironmentManager.new(testing_env)
|
|
43
|
+
Danger::Dangerfile.new(env, testing_ui)
|
|
44
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: danger-rubocop
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Ash Furrow
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2016-07-05 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: danger
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rubocop
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '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: guard
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - "~>"
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '2.14'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - "~>"
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '2.14'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: guard-rspec
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - "~>"
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '4.7'
|
|
104
|
+
type: :development
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - "~>"
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '4.7'
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: listen
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - '='
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: 3.0.7
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - '='
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: 3.0.7
|
|
125
|
+
- !ruby/object:Gem::Dependency
|
|
126
|
+
name: pry
|
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
|
128
|
+
requirements:
|
|
129
|
+
- - ">="
|
|
130
|
+
- !ruby/object:Gem::Version
|
|
131
|
+
version: '0'
|
|
132
|
+
type: :development
|
|
133
|
+
prerelease: false
|
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
135
|
+
requirements:
|
|
136
|
+
- - ">="
|
|
137
|
+
- !ruby/object:Gem::Version
|
|
138
|
+
version: '0'
|
|
139
|
+
description: A Danger plugin for running Ruby files through Rubocop.
|
|
140
|
+
email:
|
|
141
|
+
- ash@ashfurrow.com
|
|
142
|
+
executables: []
|
|
143
|
+
extensions: []
|
|
144
|
+
extra_rdoc_files: []
|
|
145
|
+
files:
|
|
146
|
+
- ".gitignore"
|
|
147
|
+
- Gemfile
|
|
148
|
+
- Gemfile.lock
|
|
149
|
+
- Guardfile
|
|
150
|
+
- LICENSE
|
|
151
|
+
- README.md
|
|
152
|
+
- Rakefile
|
|
153
|
+
- danger-rubocop.gemspec
|
|
154
|
+
- lib/danger_plugin.rb
|
|
155
|
+
- lib/version.rb
|
|
156
|
+
- spec/danger_plugin_spec.rb
|
|
157
|
+
- spec/fixtures/ruby_file.rb
|
|
158
|
+
- spec/spec_helper.rb
|
|
159
|
+
homepage: https://github.com/ashfurrow/danger-rubocop
|
|
160
|
+
licenses:
|
|
161
|
+
- MIT
|
|
162
|
+
metadata: {}
|
|
163
|
+
post_install_message:
|
|
164
|
+
rdoc_options: []
|
|
165
|
+
require_paths:
|
|
166
|
+
- lib
|
|
167
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
168
|
+
requirements:
|
|
169
|
+
- - ">="
|
|
170
|
+
- !ruby/object:Gem::Version
|
|
171
|
+
version: '0'
|
|
172
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
173
|
+
requirements:
|
|
174
|
+
- - ">="
|
|
175
|
+
- !ruby/object:Gem::Version
|
|
176
|
+
version: '0'
|
|
177
|
+
requirements: []
|
|
178
|
+
rubyforge_project:
|
|
179
|
+
rubygems_version: 2.4.8
|
|
180
|
+
signing_key:
|
|
181
|
+
specification_version: 4
|
|
182
|
+
summary: A Danger plugin for running Ruby files through Rubocop.
|
|
183
|
+
test_files:
|
|
184
|
+
- spec/danger_plugin_spec.rb
|
|
185
|
+
- spec/fixtures/ruby_file.rb
|
|
186
|
+
- spec/spec_helper.rb
|