danger 2.1.5 → 2.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -11
- data/lib/danger/commands/init.rb +1 -1
- data/lib/danger/request_source/github.rb +13 -13
- data/lib/danger/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d17d6a72e1a01c0fd06eb51f4631d2aece6a2ba
|
4
|
+
data.tar.gz: fedf8ba1df3832bfba137371bf9e6ba57ba3ca25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ac508837ab5be9fa9004e729c2c86887377e301263e9d4bf05343858852992b66e23d582d32ac7d51e59d6e121f4136d4df481b129d43c30e51626be9b16e6e
|
7
|
+
data.tar.gz: 830458880fdaa3afb529fac362158a2210abd49d0b9a914e967007ee8a63226d40e5a98402e2639727048f23543aac8ac285fbe8eb28b284473b64cfa4319761
|
data/README.md
CHANGED
@@ -17,14 +17,16 @@ Formalize your Pull Request etiquette.
|
|
17
17
|
|
18
18
|
## What is Danger?
|
19
19
|
|
20
|
-
Danger runs after your CI,
|
20
|
+
Danger runs after your CI, automating your team's conventions surrounding code review.
|
21
21
|
|
22
22
|
This provides another logical step in your process, through this Danger can help lint your rote tasks in daily code review.
|
23
23
|
|
24
|
-
You can use Danger to codify your teams norms
|
24
|
+
You can use Danger to codify your teams norms, leaving humans to think about harder problems.
|
25
25
|
|
26
26
|
## For example?
|
27
27
|
|
28
|
+
You can:
|
29
|
+
|
28
30
|
* Enforce CHANGELOGs
|
29
31
|
* Enforce links to Trello/JIRA in PR/MR bodies
|
30
32
|
* Enforce using descriptive labels
|
@@ -32,13 +34,13 @@ You can use Danger to codify your teams norms. Leaving humans to think about har
|
|
32
34
|
* Highlight interesting build artifacts
|
33
35
|
* Give specific files extra focus
|
34
36
|
|
35
|
-
Danger
|
37
|
+
Danger provides the glue to let _you_ build out the rules specific to your team's culture, offering useful metadata and a comprehensive plugin system to share common issues.
|
36
38
|
|
37
39
|
## Getting Started
|
38
40
|
|
39
|
-
Alright. So, actually, you may be in the wrong place. From here on in, this README is going to be for people who are interested in working on
|
41
|
+
Alright. So, actually, you may be in the wrong place. From here on in, this README is going to be for people who are interested in working on and improving on Danger.
|
40
42
|
|
41
|
-
We keep all of the end-user documentation
|
43
|
+
We keep all of the end-user documentation at [http://danger.systems](http://danger.systems).
|
42
44
|
|
43
45
|
Some quick links: [Guides Index](http://danger.systems/guides.html), [DSL Reference](http://danger.systems/reference.html), [Getting Started](http://danger.systems/guides/getting_started.html) and [What does Danger Do?](http://danger.systems/guides/what_does_danger_do.html).
|
44
46
|
|
@@ -57,21 +59,21 @@ This sets everything up and runs all of the tests.
|
|
57
59
|
|
58
60
|
#### Theory
|
59
61
|
|
60
|
-
Danger has a [VISION.md](https://github.com/danger/danger/blob/master/VISION.md) file,
|
62
|
+
Danger has a [VISION.md](https://github.com/danger/danger/blob/master/VISION.md) file, which sums up the ideas around what Danger is. It is the lower bounds of what Danger means. Orta has written on handling and creating Danger [on the Artsy blog](http://artsy.github.io/blog/categories/danger/), too.
|
61
63
|
|
62
64
|
#### Documentation
|
63
65
|
|
64
|
-
The code you write may end up in the public part of the website
|
66
|
+
The code you write may end up in the public part of the website — the easiest way to tell is that it is vastly overdocumented. If you are working in a space that looks over-documented, please be extra considerate to add documentation. We expect the consumers of that documentation to be non-rubyists, thus you should avoid specific jargon and try to provide duplicate overlapping examples.
|
65
67
|
|
66
68
|
#### Testing
|
67
69
|
|
68
|
-
So far, we've not really figured out the right way to make tests for our CLI commands. When we have done so, they've ended up brittle. So ideally, try to move any logic that would go into a command into separate classes, and test those. We're
|
70
|
+
So far, we've not really figured out the right way to make tests for our CLI commands. When we have done so, they've ended up being brittle. So, ideally, try to move any logic that would go into a command into separate classes, and test those. We're okay with the command not having coverage, but ideally the classes that make up what it does will.
|
69
71
|
|
70
72
|
I'd strongly recommend using `bundle exec guard` to run your tests as you work. Any changes you make in the lib, or specs will have corresponding tests run instantly.
|
71
73
|
|
72
74
|
#### Debugging
|
73
75
|
|
74
|
-
Ruby is super dynamic
|
76
|
+
Ruby is super dynamic. One of the best ways to debug Ruby code is by using [pry](http://pryrepl.org/). We include pry for developers: when you have a problem, copy these two lines just before your problem and follow the instructions from "[I Want To Be A Danger Wizard](http://danger.systems/guides/troubleshooting.html#i-want-to-be-a-danger-wizard)."
|
75
77
|
|
76
78
|
```ruby
|
77
79
|
require 'pry'
|
@@ -81,11 +83,11 @@ binding.pry
|
|
81
83
|
## Tell me of these Plugins
|
82
84
|
|
83
85
|
* Follow the [Creating your first plugin](http://danger.systems/guides/creating_your_first_plugin.html) guide
|
84
|
-
* Talk through the tech specs here
|
86
|
+
* (Talk through the tech specs here.)
|
85
87
|
|
86
88
|
## License, Contributor's Guidelines and Code of Conduct
|
87
89
|
|
88
|
-
We try to keep as much discussion as possible in GitHub issues, but also have a pretty inactive
|
90
|
+
We try to keep as much discussion as possible in GitHub issues, but also have a pretty inactive Slack --- if you'd like an invite, ping [@Orta](https://twitter.com/orta/) a DM on Twitter with your email. It's mostly interesting if you want to stay on top of Danger without all the emails from GitHub.
|
89
91
|
|
90
92
|
> This project is open source under the MIT license, which means you have full access to the source code and can modify it to fit your own needs.
|
91
93
|
|
data/lib/danger/commands/init.rb
CHANGED
@@ -90,7 +90,7 @@ module Danger
|
|
90
90
|
ui.say "Here are great resources for creative commons images of robots:"
|
91
91
|
ui.link "https://www.flickr.com/search/?text=robot&license=2%2C3%2C4%2C5%2C6%2C9"
|
92
92
|
ui.link "https://www.google.com/search?q=robot&tbs=sur:fmc&tbm=isch&tbo=u&source=univ&sa=X&ved=0ahUKEwjgy8-f95jLAhWI7hoKHV_UD00QsAQIMQ&biw=1265&bih=1359"
|
93
|
-
ui.pause
|
93
|
+
ui.pause 1
|
94
94
|
|
95
95
|
if considered_an_oss_repo?
|
96
96
|
ui.say "#{@bot_name} does not need privilidged access to your repo or org. This is because Danger will only"
|
@@ -72,13 +72,13 @@ module Danger
|
|
72
72
|
def update_pull_request!(warnings: [], errors: [], messages: [], markdowns: [], danger_id: "danger")
|
73
73
|
comment_result = {}
|
74
74
|
|
75
|
-
|
76
|
-
|
75
|
+
comments = client.issue_comments(ci_source.repo_slug, ci_source.pull_request_id)
|
76
|
+
editable_comments = comments.select { |comment| danger_comment?(comment, danger_id) }
|
77
77
|
|
78
|
-
if
|
78
|
+
if editable_comments.empty?
|
79
79
|
previous_violations = {}
|
80
80
|
else
|
81
|
-
comment =
|
81
|
+
comment = editable_comments.first[:body]
|
82
82
|
previous_violations = parse_comment(comment)
|
83
83
|
end
|
84
84
|
|
@@ -94,10 +94,10 @@ module Danger
|
|
94
94
|
danger_id: danger_id,
|
95
95
|
template: "github")
|
96
96
|
|
97
|
-
if
|
97
|
+
if editable_comments.empty?
|
98
98
|
comment_result = client.add_comment(ci_source.repo_slug, ci_source.pull_request_id, body)
|
99
99
|
else
|
100
|
-
original_id =
|
100
|
+
original_id = editable_comments.first[:id]
|
101
101
|
comment_result = client.update_comment(ci_source.repo_slug, original_id, body)
|
102
102
|
end
|
103
103
|
end
|
@@ -145,11 +145,11 @@ module Danger
|
|
145
145
|
|
146
146
|
# Get rid of the previously posted comment, to only have the latest one
|
147
147
|
def delete_old_comments!(except: nil, danger_id: "danger")
|
148
|
-
|
149
|
-
|
150
|
-
next unless
|
151
|
-
next if
|
152
|
-
client.delete_comment(ci_source.repo_slug,
|
148
|
+
comments = client.issue_comments(ci_source.repo_slug, ci_source.pull_request_id)
|
149
|
+
comments.each do |comment|
|
150
|
+
next unless danger_comment?(comment, danger_id)
|
151
|
+
next if comment[:id] == except
|
152
|
+
client.delete_comment(ci_source.repo_slug, comment[:id])
|
153
153
|
end
|
154
154
|
end
|
155
155
|
|
@@ -197,8 +197,8 @@ module Danger
|
|
197
197
|
|
198
198
|
private
|
199
199
|
|
200
|
-
def
|
201
|
-
|
200
|
+
def danger_comment?(comment, danger_id)
|
201
|
+
comment[:body].include?("generated_by_#{danger_id}")
|
202
202
|
end
|
203
203
|
end
|
204
204
|
end
|
data/lib/danger/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Orta Therox
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-08-
|
12
|
+
date: 2016-08-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: claide
|