Skip to content

Commit

Permalink
Add danger
Browse files Browse the repository at this point in the history
  • Loading branch information
msaps committed Dec 2, 2018
1 parent 846f527 commit 5907daf
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Expand Up @@ -18,6 +18,9 @@ before_install:
- brew outdated carthage || brew upgrade carthage - brew outdated carthage || brew upgrade carthage
- bundle install - bundle install


before_script:
- bundle exec danger

script: script:
- .scripts/build - .scripts/build


Expand Down
19 changes: 19 additions & 0 deletions Dangerfile
@@ -0,0 +1,19 @@

has_source_changes = !git.modified_files.grep(/Sources.*\.swift/).empty? || !git.added_files.grep(/Sources.*\.swift/).empty?
has_tests_changes = !git.modified_files.grep(/Sources\/TabmanTests.*\.swift/).empty? || !git.added_files.grep(/Sources\/TabmanTests.*\.swift/).empty?

# Make it more obvious that a PR is a work in progress and shouldn't be merged yet
warn("PR is classed as Work in Progress") if github.pr_title.include? "[WIP]"

# Warn when there is a big PR
warn("This PR might be a little too big, consider breaking it up.") if git.lines_of_code > 500

# Require PR description
warn "Please provide a summary in the PR description, it makes it easier to understand!" if github.pr_body.length < 5

# Check for source changes and prompt for test updates if non added.
if (has_source_changes && ! has_tests_changes)
warn("Looks like you changed some source files, should there have been some tests added?")
end

swiftlint.lint_files
6 changes: 4 additions & 2 deletions Gemfile
@@ -1,5 +1,7 @@


source 'https://rubygems.org' source 'https://rubygems.org'


gem "fastlane" gem 'fastlane'
gem "cocoapods" gem 'cocoapods'
gem 'danger'
gem 'danger-swiftlint'

0 comments on commit 5907daf

Please sign in to comment.