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

Fix variable name from string catalog with an acronym in the name #116

Merged
merged 1 commit into from
Oct 13, 2024

Conversation

liamnichols
Copy link
Owner

If a Strings Catalog contained an uppercase acronym at the start, the variable name generated would incorrectly only lowercase the first character.

For example:

URLStrings.xcstrings would generate a struct called URLStrings as expected, but the variable/label would be uRLStrings which is not expected.

In this PR, I update the logic so that we lowercase the n-1 initial characters if more than 1 character is uppercased at the start of the string.

This means that the example above will generate a variable named urlStrings

@liamnichols liamnichols self-assigned this Oct 13, 2024
Copy link

✅ Pull Request passed benchmark checks

Summary

Sun Oct 13 15:11:21 UTC 2024

===========================================================================================================
Threshold deviations for XCStringsToolBenchmarks:StringGenerator.generateSource(for:tableName:accessLevel:)
===========================================================================================================
Time (total CPU) (ms, Δ) main pull_request Difference Δ Threshold Δ
p0 289 292 2 0
p25 290 292 2 0
p50 290 292 2 0

New baseline 'pull_request' is WORSE than the 'main' baseline thresholds.


Comparing results between 'main' and 'pull_request'

Host 'Mac-1728830263551.local' with 3 'arm64' processors with 7 GB memory, running:
Darwin Kernel Version 23.6.0: Wed Jul 31 20:50:13 PDT 2024; root:xnu-10063.141.1.700.5~1/RELEASE_ARM64_VMAPPLE

XCStringsToolBenchmarks

StringGenerator.generateSource(for:tableName:accessLevel:) metrics

Time (total CPU) (ms) * p0 p25 p50 p75 p90 p99 p100 Samples
main 289 290 290 293 302 302 302 4
pull_request 292 292 292 292 293 293 293 4
Δ 3 2 2 -1 -9 -9 -9 0
Improvement % -1 -1 -1 0 3 3 3 0

@liamnichols liamnichols marked this pull request as ready for review October 13, 2024 15:13
@liamnichols liamnichols merged commit f8f99ed into main Oct 13, 2024
13 checks passed
@liamnichols liamnichols deleted the ln/variable-identifiers-with-acronyms branch November 11, 2024 15:45
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.

1 participant