-
Notifications
You must be signed in to change notification settings - Fork 3
✨ added check for duplicated keys -#78843 #38
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
Conversation
|
@AGr-AlexandrGrigoryev your pull request is missing a changelog! |
CHANGELOG.md
Outdated
| ## master | ||
|
|
||
| ### Added | ||
| - Add check for duplicated keys in Spreadsheet ([#38](https://github.com/AckeeCZ/ACKLocalization/pull/38), kudos to @AGr-AlexandrGrigoryev) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please rename it to "duplicate keys" 🤓
| guard rows.count > 0 else { return } | ||
|
|
||
| try checkDuplicateKeys(form: rows) | ||
| try checkDuplicatedKeys(form: rows) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"checkDuplicateKeys" was correct
| /// Check if given `rows` have a duplicated keys | ||
| public func checkDuplicatedKeys(form rows: [LocRow]) throws { | ||
| let keys = rows.map { $0.key } | ||
| let uniqueKeys = Set(rows.map { $0.key }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 let uniqueKeys = Set(keys)
| XCTAssertEqual(#""pos_arg_key" = "%1$@ people will arrive in %2$@ minutes";"#, locRow.localizableRow) | ||
| } | ||
|
|
||
| func testForDuplicatedKeys() throws { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please move it to the ACKLocalizationTests, this has nothing to do with LocRow. Also add test for success path (one duplicate keys)
|
This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Added check of duplicated keys in the Spreadsheet before writing to the file. If duplicate keys exist, show the error with duplicated keys.
Checklist