Skip to content

Commit

Permalink
Initial Danger integration
Browse files Browse the repository at this point in the history
Fixes #843
  • Loading branch information
marcelofabri committed Dec 24, 2016
1 parent 82d65c3 commit 00c5ba0
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 0 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -13,6 +13,7 @@ matrix:
env: JOB=SPM
os: osx
osx_image: xcode8.2
before_script: bundle exec danger
- script: make docker_test
env: JOB=Linux
sudo: required
Expand Down
26 changes: 26 additions & 0 deletions Dangerfile
@@ -0,0 +1,26 @@
# Warn when there is a big PR
warn("Big PR") if git.lines_of_code > 500

# Sometimes its a README fix, or something like that - which isn't relevant for
# including in a CHANGELOG for example
has_app_changes = !git.modified_files.grep(/Source/).empty?
has_test_changes = !git.modified_files.grep(/Tests/).empty?

# Add a CHANGELOG entry for app changes
if !git.modified_files.include?("CHANGELOG.md") && has_app_changes
fail("Please include a CHANGELOG entry to credit yourself! \nYou can find it at [CHANGELOG.md](https://github.com/realm/SwiftLint/blob/master/CHANGELOG.md).")
markdown <<-MARKDOWN
Here's an example of your CHANGELOG entry:
```markdown
* #{github.pr_title}#{' '}
[#{github.pr_author}](https://github.com/#{github.pr_author})
[#issue_number](https://github.com/realm/SwiftLint/issues/issue_number)
```
*note*: There are two invisible spaces after the entry's text.
MARKDOWN
end

# Non-trivial amounts of app changes without tests
if git.lines_of_code > 50 && has_app_changes && !has_test_changes
warn "This PR may need tests."
end
4 changes: 4 additions & 0 deletions Gemfile
@@ -0,0 +1,4 @@
# frozen_string_literal: true
source "https://rubygems.org"

gem "danger"
51 changes: 51 additions & 0 deletions Gemfile.lock
@@ -0,0 +1,51 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.5.0)
public_suffix (~> 2.0, >= 2.0.2)
claide (1.0.1)
claide-plugins (0.9.2)
cork
nap
open4 (~> 1.3)
colored (1.2)
cork (0.2.0)
colored (~> 1.2)
danger (4.0.3)
claide (~> 1.0)
claide-plugins (>= 0.9.2)
colored (~> 1.2)
cork (~> 0.1)
faraday (~> 0.9)
faraday-http-cache (~> 1.0)
git (~> 1)
kramdown (~> 1.5)
octokit (~> 4.2)
terminal-table (~> 1)
faraday (0.10.0)
multipart-post (>= 1.2, < 3)
faraday-http-cache (1.3.1)
faraday (~> 0.8)
git (1.3.0)
kramdown (1.13.1)
multipart-post (2.0.0)
nap (1.1.0)
octokit (4.6.2)
sawyer (~> 0.8.0, >= 0.5.3)
open4 (1.3.4)
public_suffix (2.0.4)
sawyer (0.8.1)
addressable (>= 2.3.5, < 2.6)
faraday (~> 0.8, < 1.0)
terminal-table (1.7.3)
unicode-display_width (~> 1.1.1)
unicode-display_width (1.1.2)

PLATFORMS
ruby

DEPENDENCIES
danger

BUNDLED WITH
1.13.6

0 comments on commit 00c5ba0

Please sign in to comment.