✨ added check for duplicated keys -#78843#38
Merged
LukasHromadnik merged 3 commits intomasterfrom Apr 6, 2023
Merged
Conversation
|
@AGr-AlexandrGrigoryev your pull request is missing a changelog! |
LukasHromadnik
requested changes
Feb 27, 2023
CHANGELOG.md
Outdated
| ## master | ||
|
|
||
| ### Added | ||
| - Add check for duplicated keys in Spreadsheet ([#38](https://github.com/AckeeCZ/ACKLocalization/pull/38), kudos to @AGr-AlexandrGrigoryev) |
Contributor
There was a problem hiding this comment.
please rename it to "duplicate keys" 🤓
| guard rows.count > 0 else { return } | ||
|
|
||
| try checkDuplicateKeys(form: rows) | ||
| try checkDuplicatedKeys(form: rows) |
Contributor
There was a problem hiding this comment.
"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 }) |
Contributor
There was a problem hiding this comment.
💡 let uniqueKeys = Set(keys)
| XCTAssertEqual(#""pos_arg_key" = "%1$@ people will arrive in %2$@ minutes";"#, locRow.localizableRow) | ||
| } | ||
|
|
||
| func testForDuplicatedKeys() throws { |
Contributor
There was a problem hiding this comment.
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. |
LukasHromadnik
approved these changes
Apr 6, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added check of duplicated keys in the Spreadsheet before writing to the file. If duplicate keys exist, show the error with duplicated keys.
Checklist