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

[action][update_info_plist] improve the plist file-path option validation check #20356

Merged
merged 2 commits into from
Jun 25, 2022

Conversation

crazymanish
Copy link
Member

Checklist

  • I've run bundle exec rspec from the root directory to see all new and existing tests pass
  • I've followed the fastlane code style and run bundle exec rubocop -a to ensure the code style is valid
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary.

Motivation and Context

  • Plist file-path Validation block was using range [-6..-1] which is a kind of magical number range for non-ruby developer

Description

  • Improve the plist file-path option validation check using value.end_with?(".plist") which is more readable, i hope 😍

Testing Steps

  • N/A

@@ -80,7 +80,7 @@ def self.available_options
description: "Path to info plist",
optional: true,
verify_block: proc do |value|
UI.user_error!("Invalid plist file") unless value[-6..-1].casecmp(".plist").zero?
UI.user_error!("Invalid plist file") unless value.end_with?(".plist")
Copy link
Collaborator

Choose a reason for hiding this comment

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

don't you want something like value.downcase.end_with?(".plist") to keep the casecmp? or it this not necessary anymore?

Alternatively value =~ /\.plist^/i is an option I guess

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you for your review. applied suggestion. 🙇

@crazymanish crazymanish requested a review from lacostej June 10, 2022 21:07
@joshdholtz joshdholtz changed the title [action][update_info_plist] Improve the plist file-path option validation check [action][update_info_plist] improve the plist file-path option validation check Jun 25, 2022
Copy link
Member

@joshdholtz joshdholtz left a comment

Choose a reason for hiding this comment

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

Looks great to me! This feels much better 😊

@joshdholtz joshdholtz merged commit 3f88926 into master Jun 25, 2022
crazymanish added a commit that referenced this pull request Jun 26, 2022
* master:
  [pilot] added the Pilot::TesterExporter class unit tests (#20394)
  Add device Google Pixel 5 (#20389)
  [action][update_info_plist] improve the plist file-path option validation check (#20356)
  Specify s3 object prefix (#20344)
  [snapshot] Add missing iPod touch to Generated Snapshot Reports (#20337)
  [Ruby] Ruby 2.6 is now the minimum (dropping Ruby 2.5) (#20413)
@fastlane-bot
Copy link

Hey @crazymanish 👋

Thank you for your contribution to fastlane and congrats on getting this pull request merged 🎉
The code change now lives in the master branch, however it wasn't released to RubyGems yet.
We usually ship about once a week, and your PR will be included in the next one.

Please let us know if this change requires an immediate release by adding a comment here 👍
We'll notify you once we shipped a new release with your changes 🚀

@fastlane-bot
Copy link

Congratulations! 🎉 This was released as part of fastlane 2.207.0 🚀

@fastlane fastlane locked and limited conversation to collaborators Aug 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants