Class: Danger::ManifestPRChecker
- Inherits:
-
Plugin
- Object
- Plugin
- Danger::ManifestPRChecker
- Defined in:
- lib/dangermattic/plugins/manifest_pr_checker.rb
Overview
Plugin to check if the a lock file (Gemfile.lock, Podfile.lock, Package.resolved) was updated when changing a manifest file (Gemfile, Podfile, Package.swift) in a PR.
Constant Summary collapse
- MESSAGE =
'`%s` was changed without updating its corresponding `%s`. %s.'- SWIFT_INSTRUCTION =
The two new lines at the start are intentional. This will be interpolated in MESSAGE into the final %s. The first new line moves it to a new line, the second adds visual padding.
<<~INSTRUCTION If the change includes adding, removing, or editing a dependency please resolve the Swift packages as appropriate to your project setup (e.g. in Xcode or by running `swift package resolve`). If the change to the `Package.swift` did not modify dependencies, ignoring this warning should be safe, but we recommend double checking and running the package resolution just in case. INSTRUCTION
Instance Method Summary collapse
-
#check_all_manifest_lock_updated(report_type: :warning) ⇒ void
Performs all the checks, asserting that changes on
Gemfile,PodfileandPackage.swiftmust have corresponding lock file changes. -
#check_gemfile_lock_updated(report_type: :warning) ⇒ void
Check if the
Gemfilefile was modified without a correspondingGemfile.lockupdate. -
#check_podfile_lock_updated(report_type: :warning) ⇒ void
Check if the
Podfilefile was modified without a correspondingPodfile.lockupdate. -
#check_swift_package_resolved_updated(report_type: :warning) ⇒ void
Check if the
Package.swiftfile was modified without a correspondingPackage.resolvedupdate. -
#check_swift_package_resolved_updated_strict(manifest_path:, manifest_lock_path:, report_type: :warning) ⇒ void
Check if the
Package.swiftfile was modified without a correspondingPackage.resolvedupdate, checking for exact path matches.
Instance Method Details
#check_all_manifest_lock_updated(report_type: :warning) ⇒ void
This method returns an undefined value.
Performs all the checks, asserting that changes on Gemfile, Podfile and Package.swift must have corresponding
lock file changes.
50 51 52 53 54 |
# File 'lib/dangermattic/plugins/manifest_pr_checker.rb', line 50 def check_all_manifest_lock_updated(report_type: :warning) check_gemfile_lock_updated(report_type: report_type) check_podfile_lock_updated(report_type: report_type) check_swift_package_resolved_updated(report_type: report_type) end |
#check_gemfile_lock_updated(report_type: :warning) ⇒ void
This method returns an undefined value.
Check if the Gemfile file was modified without a corresponding Gemfile.lock update
61 62 63 64 65 66 67 68 |
# File 'lib/dangermattic/plugins/manifest_pr_checker.rb', line 61 def check_gemfile_lock_updated(report_type: :warning) check_manifest_lock_updated( file_name: 'Gemfile', lock_file_name: 'Gemfile.lock', instruction: 'Please run `bundle install` or `bundle update <updated_gem>`', report_type: report_type ) end |
#check_podfile_lock_updated(report_type: :warning) ⇒ void
This method returns an undefined value.
Check if the Podfile file was modified without a corresponding Podfile.lock update
75 76 77 78 79 80 81 82 |
# File 'lib/dangermattic/plugins/manifest_pr_checker.rb', line 75 def check_podfile_lock_updated(report_type: :warning) check_manifest_lock_updated( file_name: 'Podfile', lock_file_name: 'Podfile.lock', instruction: 'Please run `bundle exec pod install`', report_type: report_type ) end |
#check_swift_package_resolved_updated(report_type: :warning) ⇒ void
This method returns an undefined value.
Check if the Package.swift file was modified without a corresponding Package.resolved update
89 90 91 92 93 94 95 96 |
# File 'lib/dangermattic/plugins/manifest_pr_checker.rb', line 89 def check_swift_package_resolved_updated(report_type: :warning) check_manifest_lock_updated( file_name: 'Package.swift', lock_file_name: 'Package.resolved', instruction: SWIFT_INSTRUCTION, report_type: report_type ) end |
#check_swift_package_resolved_updated_strict(manifest_path:, manifest_lock_path:, report_type: :warning) ⇒ void
This method returns an undefined value.
Check if the Package.swift file was modified without a corresponding Package.resolved update,
checking for exact path matches
106 107 108 109 110 111 112 113 |
# File 'lib/dangermattic/plugins/manifest_pr_checker.rb', line 106 def check_swift_package_resolved_updated_strict(manifest_path:, manifest_lock_path:, report_type: :warning) check_manifest_lock_updated_strict( manifest_path: manifest_path, manifest_lock_path: manifest_lock_path, instruction: SWIFT_INSTRUCTION, report_type: report_type ) end |