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

Update 'nslocalizedstring_key' rule to also require static strings for the 'comment' field #3334

Closed
2 tasks done
daltonclaybrook opened this issue Sep 8, 2020 · 0 comments · Fixed by #3373
Closed
2 tasks done

Comments

@daltonclaybrook
Copy link
Contributor

New Issue Checklist

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)")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant