danger-local_rules 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 +7 -0
- data/.bundle/config +3 -0
- data/.gitignore +7 -0
- data/.rubocop.yml +152 -0
- data/.travis.yml +10 -0
- data/Gemfile +4 -0
- data/Guardfile +19 -0
- data/LICENSE.txt +22 -0
- data/README.md +19 -0
- data/Rakefile +10 -0
- data/danger-local_rules.gemspec +40 -0
- data/lib/danger_local_rules.rb +1 -0
- data/lib/danger_plugin.rb +1 -0
- data/lib/local_rules/gem_version.rb +3 -0
- data/lib/local_rules/plugin.rb +46 -0
- data/spec/fixtures/pr_diff_failure_sample.txt +17 -0
- data/spec/fixtures/pr_diff_sample.txt +16 -0
- data/spec/fixtures/pr_diff_warning_sample.txt +17 -0
- data/spec/local_rules_spec.rb +55 -0
- data/spec/spec_helper.rb +77 -0
- metadata +208 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: fda2810b2f0e1b23d702c417b31411612e122c94d1b35ae3cd2ec62c53c1ddf1
|
4
|
+
data.tar.gz: 5186f9dd722e92189adfcdf5d3d3b082970aba869ca52f783eb862e7c4f7bff5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7f5ee9435d73834639b9d85f72e94f3018dc87760a8b0b85a84f821b30d35cd70a9cd5f6c9f869520592d670731b0fd286c8121e7e8aec117566a643cb5f612b
|
7
|
+
data.tar.gz: 6104cd1344f4fac77a9baa46619632c14f1adae5369aa9e7fb0aa8f555fd2302e60a41be215c65547bb9303a34774eb2ece46f3236483a16c74d15b24eabf0df
|
data/.bundle/config
ADDED
data/.gitignore
ADDED
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.5
|
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
data/Gemfile
ADDED
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) 2018 Takuma Homma <nagomimatcha@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,19 @@
|
|
1
|
+
# danger-local_rules
|
2
|
+
|
3
|
+
A description of danger-local_rules.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
$ gem install danger-local_rules
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
$ local_rules.check
|
12
|
+
|
13
|
+
## Development
|
14
|
+
|
15
|
+
1. Clone this repo
|
16
|
+
2. Run `bundle install` to setup dependencies.
|
17
|
+
3. Run `bundle exec rake spec` to run the tests.
|
18
|
+
4. Use `bundle exec guard` to automatically have tests run as you make changes.
|
19
|
+
5. Make your changes.
|
data/Rakefile
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'local_rules/gem_version.rb'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'danger-local_rules'
|
8
|
+
spec.version = LocalRules::VERSION
|
9
|
+
spec.authors = ['mataku']
|
10
|
+
spec.email = ['nagomimatcha@gmail.com']
|
11
|
+
spec.description = %q{Manage local rules by Danger.}
|
12
|
+
spec.summary = %q{Manage local rules by Danger.}
|
13
|
+
spec.homepage = 'https://github.com/mataku/danger-local_rules'
|
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 'git_diff_parser'
|
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
|
+
spec.add_development_dependency 'pry'
|
40
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require "local_rules/gem_version"
|
@@ -0,0 +1 @@
|
|
1
|
+
require "local_rules/plugin"
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'git_diff_parser'
|
2
|
+
|
3
|
+
module Danger
|
4
|
+
class DangerLocalRules < Plugin
|
5
|
+
def check
|
6
|
+
diff = github.pr_diff
|
7
|
+
return if diff.nil?
|
8
|
+
|
9
|
+
failure_rules = rules['failure']
|
10
|
+
warning_rules = rules['warning']
|
11
|
+
return if failure_rules.nil? && warning_rules.nil?
|
12
|
+
|
13
|
+
if diff.match(Regexp.union(failure_rules.keys + warning_rules.keys))
|
14
|
+
regexp_to_fail = Regexp.union(failure_rules.keys)
|
15
|
+
regexp_to_warn = Regexp.union(warning_rules.keys)
|
16
|
+
|
17
|
+
GitDiffParser.parse(diff).each do |changed_file|
|
18
|
+
next if changed_file.file == 'Dangerfile'
|
19
|
+
changed_file.changed_lines.each do |changed_line|
|
20
|
+
content = changed_line.content
|
21
|
+
# Only checks added contents
|
22
|
+
next unless content.start_with?('+')
|
23
|
+
|
24
|
+
if (content.match(regexp_to_fail))
|
25
|
+
content.match(regexp_to_fail) do |data|
|
26
|
+
fail(failure_rules[data[0]], file: changed_file.file, line: changed_line.number)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
if (content.match(regexp_to_warn))
|
31
|
+
content.match(regexp_to_warn) do |data|
|
32
|
+
warn(warning_rules[data[0]], file: changed_file.file, line: changed_line.number)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def rules
|
43
|
+
YAML.load_file('.danger_local_rules.yml')
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
diff --git a/spec/local_rules_spec.rb b/spec/local_rules_spec.rb
|
2
|
+
index 846751e..c6d4023 100644
|
3
|
+
--- a/spec/local_rules_spec.rb
|
4
|
+
+++ b/spec/local_rules_spec.rb
|
5
|
+
@@ -1,41 +1,9 @@
|
6
|
+
-require File.expand_path("../spec_helper", __FILE__)
|
7
|
+
+require File.expand_path('../spec_helper', __FILE__)
|
8
|
+
|
9
|
+
module Danger
|
10
|
+
describe Danger::DangerLocalRules do
|
11
|
+
- it "should be a plugin" do
|
12
|
+
+ it 'should be a plugin' do
|
13
|
+
+ legacy
|
14
|
+
+ typo
|
15
|
+
expect(Danger::DangerLocalRules.new(nil)).to be_a Danger::Pl
|
16
|
+
ugin
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
diff --git a/spec/local_rules_spec.rb b/spec/local_rules_spec.rb
|
2
|
+
index 846751e..c6d4023 100644
|
3
|
+
--- a/spec/local_rules_spec.rb
|
4
|
+
+++ b/spec/local_rules_spec.rb
|
5
|
+
@@ -1,41 +1,9 @@
|
6
|
+
-require File.expand_path("../spec_helper", __FILE__)
|
7
|
+
+require File.expand_path('../spec_helper', __FILE__)
|
8
|
+
|
9
|
+
module Danger
|
10
|
+
describe Danger::DangerLocalRules do
|
11
|
+
- it "should be a plugin" do
|
12
|
+
+ it 'should be a plugin' do
|
13
|
+
|
14
|
+
expect(Danger::DangerLocalRules.new(nil)).to be_a Danger::Pl
|
15
|
+
ugin
|
16
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
diff --git a/spec/local_rules_spec.rb b/spec/local_rules_spec.rb
|
2
|
+
index 846751e..c6d4023 100644
|
3
|
+
--- a/spec/local_rules_spec.rb
|
4
|
+
+++ b/spec/local_rules_spec.rb
|
5
|
+
@@ -1,41 +1,9 @@
|
6
|
+
-require File.expand_path("../spec_helper", __FILE__)
|
7
|
+
+require File.expand_path('../spec_helper', __FILE__)
|
8
|
+
|
9
|
+
module Danger
|
10
|
+
describe Danger::DangerLocalRules do
|
11
|
+
- it "should be a plugin" do
|
12
|
+
+ it 'should be a plugin' do
|
13
|
+
+ TODO:
|
14
|
+
|
15
|
+
expect(Danger::DangerLocalRules.new(nil)).to be_a Danger::Pl
|
16
|
+
ugin
|
17
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require File.expand_path('../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
module Danger
|
4
|
+
describe Danger::DangerLocalRules do
|
5
|
+
let(:dangerfile) { testing_dangerfile }
|
6
|
+
let(:plugin) { dangerfile.local_rules }
|
7
|
+
let(:pr_diff) { dummy_pr_diff }
|
8
|
+
let(:load_data) do
|
9
|
+
{
|
10
|
+
"failure" => {"legacy"=>"No!", "typo"=>"type"},
|
11
|
+
"warning" => {"TODO"=>"You should check"}
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should be a plugin' do
|
16
|
+
expect(Danger::DangerLocalRules.new(nil)).to be_a Danger::Plugin
|
17
|
+
end
|
18
|
+
|
19
|
+
describe '#check' do
|
20
|
+
let(:github_plugin) { Danger::DangerfileGitHubPlugin }
|
21
|
+
|
22
|
+
before do
|
23
|
+
allow(YAML).to receive(:load_file).with('.danger_local_rules.yml').and_return(load_data)
|
24
|
+
allow_any_instance_of(github_plugin).to receive(:pr_diff).and_return(pr_diff)
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'passed' do
|
28
|
+
it do
|
29
|
+
plugin.check
|
30
|
+
expect(dangerfile.status_report[:errors].length).to eq(0)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'diff which included string to warn' do
|
35
|
+
let(:pr_diff) { dummy_warning_pr_diff }
|
36
|
+
|
37
|
+
it 'should have a warning comment' do
|
38
|
+
plugin.check
|
39
|
+
expect(dangerfile.status_report[:errors].length).to eq(0)
|
40
|
+
expect(dangerfile.status_report[:warnings].length).to eq(1)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context 'diff which included 2 strings to fail' do
|
45
|
+
let(:pr_diff) { dummy_failure_pr_diff }
|
46
|
+
|
47
|
+
it 'should have 2 failure comments' do
|
48
|
+
plugin.check
|
49
|
+
expect(dangerfile.status_report[:errors].length).to eq(2)
|
50
|
+
expect(dangerfile.status_report[:warnings].length).to eq(0)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,77 @@
|
|
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
|
66
|
+
|
67
|
+
def dummy_pr_diff
|
68
|
+
File.read(File.expand_path('../fixtures/pr_diff_sample.txt', __FILE__)).chomp
|
69
|
+
end
|
70
|
+
|
71
|
+
def dummy_warning_pr_diff
|
72
|
+
File.read(File.expand_path('../fixtures/pr_diff_warning_sample.txt', __FILE__)).chomp
|
73
|
+
end
|
74
|
+
|
75
|
+
def dummy_failure_pr_diff
|
76
|
+
File.read(File.expand_path('../fixtures/pr_diff_failure_sample.txt', __FILE__)).chomp
|
77
|
+
end
|
metadata
ADDED
@@ -0,0 +1,208 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: danger-local_rules
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- mataku
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-03-27 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: git_diff_parser
|
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: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
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'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
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: pry
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
description: Manage local rules by Danger.
|
154
|
+
email:
|
155
|
+
- nagomimatcha@gmail.com
|
156
|
+
executables: []
|
157
|
+
extensions: []
|
158
|
+
extra_rdoc_files: []
|
159
|
+
files:
|
160
|
+
- ".bundle/config"
|
161
|
+
- ".gitignore"
|
162
|
+
- ".rubocop.yml"
|
163
|
+
- ".travis.yml"
|
164
|
+
- Gemfile
|
165
|
+
- Guardfile
|
166
|
+
- LICENSE.txt
|
167
|
+
- README.md
|
168
|
+
- Rakefile
|
169
|
+
- danger-local_rules.gemspec
|
170
|
+
- lib/danger_local_rules.rb
|
171
|
+
- lib/danger_plugin.rb
|
172
|
+
- lib/local_rules/gem_version.rb
|
173
|
+
- lib/local_rules/plugin.rb
|
174
|
+
- spec/fixtures/pr_diff_failure_sample.txt
|
175
|
+
- spec/fixtures/pr_diff_sample.txt
|
176
|
+
- spec/fixtures/pr_diff_warning_sample.txt
|
177
|
+
- spec/local_rules_spec.rb
|
178
|
+
- spec/spec_helper.rb
|
179
|
+
homepage: https://github.com/mataku/danger-local_rules
|
180
|
+
licenses:
|
181
|
+
- MIT
|
182
|
+
metadata: {}
|
183
|
+
post_install_message:
|
184
|
+
rdoc_options: []
|
185
|
+
require_paths:
|
186
|
+
- lib
|
187
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
188
|
+
requirements:
|
189
|
+
- - ">="
|
190
|
+
- !ruby/object:Gem::Version
|
191
|
+
version: '0'
|
192
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
193
|
+
requirements:
|
194
|
+
- - ">="
|
195
|
+
- !ruby/object:Gem::Version
|
196
|
+
version: '0'
|
197
|
+
requirements: []
|
198
|
+
rubyforge_project:
|
199
|
+
rubygems_version: 2.7.6
|
200
|
+
signing_key:
|
201
|
+
specification_version: 4
|
202
|
+
summary: Manage local rules by Danger.
|
203
|
+
test_files:
|
204
|
+
- spec/fixtures/pr_diff_failure_sample.txt
|
205
|
+
- spec/fixtures/pr_diff_sample.txt
|
206
|
+
- spec/fixtures/pr_diff_warning_sample.txt
|
207
|
+
- spec/local_rules_spec.rb
|
208
|
+
- spec/spec_helper.rb
|