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

Special Quote Cases for Commented Strings #245

Merged
merged 1 commit into from
Mar 15, 2018

Conversation

briantkelley
Copy link
Contributor

@briantkelley briantkelley commented Mar 7, 2018

Short description 📝

Xcode adds quotes around strings in the project file if they contain a triple underscore or double forward slash. Update xcproj to do the same.

Solution 📦

Check for occurrences of the special sequences and add quotes if they occur.

Implementation 👩‍💻👨‍💻

  • Add a check for a triple underscore after checking for invalid characters.
  • Add another check for the double forward slash
  • Add test cases for these strings.

This change is Reviewable

if !escaped.isQuoted && escaped.rangeOfCharacter(from: CommentedString.invalidCharacters) != nil {
if !escaped.isQuoted &&
(escaped.rangeOfCharacter(from: CommentedString.invalidCharacters) != nil ||
escaped.range(of: "___") != nil ||
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about we add a CommentedString.invalidStrings

Copy link
Contributor

@pepicrft pepicrft left a comment

Choose a reason for hiding this comment

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

What @yonaskolb said and 👍

@briantkelley briantkelley force-pushed the commentedstring-quotes branch 2 times, most recently from b3f3bd7 to ad70abd Compare March 9, 2018 16:40
@briantkelley
Copy link
Contributor Author

Friendly ping ☺️. Are the updates in line with what you were thinking? #244 as well. Thanks!

Xcode has a weird rule that causes it to quote strings with a triple underscore. It also quotes strings that have a double forward slash. Add support for those in order to improve eliminate diffs.
@briantkelley briantkelley merged commit 15be0fa into master Mar 15, 2018
@pepicrft pepicrft deleted the commentedstring-quotes branch March 16, 2018 05:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants