Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a Danger rule to check for (simultaneous) changes in CocoaPods / Carthage files #808

Merged
merged 3 commits into from
Nov 30, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Dangerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,19 @@ 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

# Warn when either the podspec or Cartfile + Cartfile.resolved has been updated,
# but not both.
podspec_updated = !git.modified_files.grep(/Moya.podspec).empty?
cartfile_updated = !git.modified_files.grep(/Cartfile).empty?
cartfile_resolved_updated = !git.modified_files.grep(/Cartfile.resolved).empty?

if podspec_updated && !cartfile_updated && !cartfile_resolved_updated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be

if podspec_updated && (!cartfile_updated || !cartfile_resolved_updated)

just like line 46?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. Changed.

warn("The `podspec` was updated, but there were no changes in either the `Cartfile` nor `Cartfile.resolved`. Did you forget updating `Cartfile` or `Cartfile.resolved`?")
end

if (cartfile_updated || cartfile_resolved_updated) && !podspec_updated
warn("The `Cartfile` or `Cartfile.resolved` was updated, but there were no changes in the `podspec`. Did you forget updating the `podspec`?")
end

# Run SwiftLint
swiftlint.lint_files