Progress Warn reviewers the PR has a lot of lines changed Fail if someone accidentally skipped all tests Fail if there is app code changes without a changelog entry Fail if there are new source files that are not reflected in Xcode Warn if there’s no documentation changes for big PRs
that - which isn't relevant for # including in a project's CHANGELOG for example not_declared_trivial = !(github.pr_title.include? "#trivial") has_app_changes = !git.modified_files.grep(/Source/).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("Big PR") if git.lines_of_code > 500 # Don't let testing shortcuts get into master by accident fail("fit left in tests") if `grep -r "fit Demo/Tests/ `.length > 1 # Changelog entries are required for changes to library files. no_changelog_entry = !git.modified_files.include?("Changelog.md") if has_app_changes && no_changelog_entry && not_declared_trivial fail("Any changes to library code need a summary in the Changelog.") end # Added (or removed) library files need to be added (or removed) from the # Carthage Xcode project to avoid breaking things for our Carthage users. added_swift_library_files = git.added_files.grep(/Source.*\.swift/).empty? deleted_swift_library_files = git.deleted_files.grep(/Source.*\.swift/).empty? modified_carthage_xcode_project = !(git.deleted_files.grep(/Moya\.xcodeproj/).empty?) if (added_swift_library_files || deleted_swift_library_files) && modified_carthage_xcode_project fail("Added or removed library files require the Carthage Xcode project to be updated.") end missing_doc_changes = git.modified_files.grep(/docs/).empty? doc_changes_recommended = insertions > 15 if has_app_changes && missing_doc_changes && doc_changes_recommended warn("Consider adding supporting documentation to this change. Documentation can be found in the `docs` directory.") end # Run SwiftLint swiftlint.lint_files
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("Big PR") if git.lines_of_code > 500 # Don't let testing shortcuts get into master by accident fail("fit left in tests") if `grep -r "fit Demo/Tests/ `.length > 1
that - which isn't relevant for # including in a project's CHANGELOG for example not_declared_trivial = !(github.pr_title.include? "#trivial") has_app_changes = !git.modified_files.grep(/Source/).empty? # Changelog entries are required for changes to library files. no_changelog_entry = !git.modified_files.include?("Changelog.md") if has_app_changes && no_changelog_entry && not_declared_trivial fail("Any changes to library code need a summary in the Changelog.") end missing_doc_changes = git.modified_files.grep(/docs/).empty? doc_changes_recommended = insertions > 15 if has_app_changes && missing_doc_changes && doc_changes_recommended warn("Consider adding supporting documentation to this change. Documentation can be found in the `docs` directory.") end
added (or removed) from the # Carthage Xcode project to avoid breaking things for our Carthage users. added_swift_library_files = git.added_files.grep(/Source.*\.swift/).empty? deleted_swift_library_files = git.deleted_files.grep(/Source.*\.swift/).empty? modified_carthage_xcode_project = !(git.deleted_files.grep(/Moya\.xcodeproj/).empty?) if (added_swift_library_files || deleted_swift_library_files) && modified_carthage_xcode_project fail("Added or removed library files require the Carthage Xcode project to be updated.") end # Run SwiftLint swiftlint.lint_files
[String] Paths for files that were removed during the diff deleted_files [String] Paths for files that changed during the diff modified_files [String] The overall lines of code added/removed in the diff lines_of_code Int The overall lines of code removed in the diff deletions Int The overall lines of code added in the diff insertions Int The log of commits inside the diff commits Git::Log Details for a specific file in this diff diff_for_file Git::Diff::DiffFile GIT
text of the Pull Request. pr_body String The username of the author of the Pull Request. pr_author String The labels assigned to the Pull Request. pr_labels String The base commit to which the PR is going to be merged as a parent. base_commit String The head commit to which the PR is requesting to be merged from. head_commit String The hash that represents the PR's JSON. pr_json Hash Provides access to an API client used inside Danger. Different per platform. api Octokit::Client Github gitlab bitbucket
String, line=nil: String) Print out a generate message on the PR message (message: String, sticky=true: Boolean, file=nil: String, line=nil: String) Specifies a problem, but not critical warn (message: String, sticky=true: Boolean, file=nil: String, line=nil: String) Declares a CI blocking error fail (message: String, sticky=true: Boolean, file=nil: String, line=nil: String) A list of all messages passed to Danger, including the markdowns. status_report Hash A list of all violations passed to Danger, we don't anticipate users of Danger needing to use this. violation_report Hash Messaging
Apply Commit Rules Enforce CHANGLOGs Only let certain developers touch some files Show slow swift compilation steps Keep your Git history short highlight undocumented methods Check if the author is in an org Ensure PR summaries Ensure each PR has a JIRA ticket Ensure developers write tests Only accept PRs to a specific branch Ensure all PRs have an assignee Warn when specific libs are added Fail big PRs Add links to build artifacts Run linters on your code, highlighting per line Ensure some files are never changed Ensure some texts are never added to files Ensure coupled files are both changed Prose check files Ensure PR title Merge OK PRs automatically