Update 'nslocalizedstring_key' rule to also require static strings for the 'comment' field #3334
Closed
Description
New Issue Checklist
- Updated SwiftLint to the latest version
- I searched for existing GitHub issues
New rule request
The nslocalizedstring_key
rule requires static strings to be used as the key in calls to NSLocalizedString(...)
, but the comment
field also has this same requirement. When a dynamic string is used, the exported strings/xliff files contain the comment, "No comment provided by engineer."
Since the rule implementation is likely very similar to the one for the existing nslocalizedstring_key
rule, I believe it makes sense to extend this rule to include the comment
check.
Non-triggering"
NSLocalizedString("key", comment: "my static comment")
NSLocalizedString("key", comment: nil)
Triggering:
NSLocalizedString("key", comment: myVariable)
NSLocalizedString("key", comment: "interpolated \(param)")
Metadata
Assignees
Labels
No labels