Skip to content

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

Closed
@daltonclaybrook

Description

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)")

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions