SwiftLint icon indicating copy to clipboard operation
SwiftLint copied to clipboard

Update `nslocalizedstring_key` to validate all NSLocalizedString parameters

Open theoriginalbit opened this issue 4 years ago • 2 comments

Also rename the rule to nslocalizedstring_requires_staticstring_arguments to better match what it is now doing.

This furthers the work done in #3373 and validates all parameters when provided in the call. After this change it will validate the key, tableName, value, and comment arguments and ensure they are static strings.

theoriginalbit avatar Oct 02 '21 12:10 theoriginalbit

5 Warnings
:warning: This PR introduced a violation in Firefox: /Client/Frontend/Strings.swift:27:104: warning: NSLocalizedString Requires StaticString Arguments Violation: All NSLocalizedString parameters (except bundle) should be static strings in order for genstrings to work. (nslocalizedstring_requires_staticstring_arguments)
:warning: This PR introduced a violation in Firefox: /Client/Frontend/Strings.swift:27:30: warning: NSLocalizedString Requires StaticString Arguments Violation: All NSLocalizedString parameters (except bundle) should be static strings in order for genstrings to work. (nslocalizedstring_requires_staticstring_arguments)
:warning: This PR introduced a violation in Firefox: /Client/Frontend/Strings.swift:27:46: warning: NSLocalizedString Requires StaticString Arguments Violation: All NSLocalizedString parameters (except bundle) should be static strings in order for genstrings to work. (nslocalizedstring_requires_staticstring_arguments)
:warning: This PR introduced a violation in Firefox: /Client/Frontend/Strings.swift:27:88: warning: NSLocalizedString Requires StaticString Arguments Violation: All NSLocalizedString parameters (except bundle) should be static strings in order for genstrings to work. (nslocalizedstring_requires_staticstring_arguments)
:warning: This PR introduced a violation in WordPress: /WordPress/WordPressTest/I18n.swift:5:30: warning: NSLocalizedString Requires StaticString Arguments Violation: All NSLocalizedString parameters (except bundle) should be static strings in order for genstrings to work. (nslocalizedstring_requires_staticstring_arguments)
31 Messages
:book: Linting Aerial with this PR took 0.96s vs 0.95s on master (1% slower)
:book: Linting Alamofire with this PR took 0.97s vs 0.96s on master (1% slower)
:book: Linting Firefox with this PR took 3.26s vs 3.23s on master (0% slower)
:book: Linting Kickstarter with this PR took 6.21s vs 6.19s on master (0% slower)
:book: Linting Moya with this PR took 4.33s vs 4.36s on master (0% faster)
:book: Linting Nimble with this PR took 0.38s vs 0.38s on master (0% slower)
:book: Linting Quick with this PR took 0.18s vs 0.18s on master (0% slower)
:book: Linting Realm with this PR took 5.04s vs 5.02s on master (0% slower)
:book: Linting SourceKitten with this PR took 0.31s vs 0.31s on master (0% slower)
:book: Linting Sourcery with this PR took 1.86s vs 1.87s on master (0% faster)
:book: Linting Swift with this PR took 1.44s vs 1.45s on master (0% faster)
:book: Linting WordPress with this PR took 6.53s vs 6.54s on master (0% faster)
:book: This PR fixed a violation in Firefox: /Client/Frontend/Strings.swift:27:104: warning: NSLocalizedString Key Violation: Static strings should be used as key/comment in NSLocalizedString in order for genstrings to work. (nslocalizedstring_key)
:book: This PR fixed a violation in Firefox: /Client/Frontend/Strings.swift:27:30: warning: NSLocalizedString Key Violation: Static strings should be used as key/comment in NSLocalizedString in order for genstrings to work. (nslocalizedstring_key)
:book: This PR fixed a violation in Firefox: /Client/UIScrollViewSwizzled.swift:10:13: warning: Prefixed Top-Level Constant Violation: Top-level constants should be prefixed by k. (prefixed_toplevel_constant)
:book: This PR fixed a violation in Firefox: /Client/UIScrollViewSwizzled.swift:11:5: warning: Explicit Type Interface Violation: Properties should have a type interface (explicit_type_interface)
:book: This PR fixed a violation in Firefox: /Client/UIScrollViewSwizzled.swift:12:5: warning: Explicit Type Interface Violation: Properties should have a type interface (explicit_type_interface)
:book: This PR fixed a violation in Firefox: /Client/UIScrollViewSwizzled.swift:13:1: warning: Line Length Violation: Line should be 120 characters or less: currently 162 characters (line_length)
:book: This PR fixed a violation in Firefox: /Client/UIScrollViewSwizzled.swift:13:5: warning: Conditional Returns on Newline Violation: Conditional statements should always return on the next line (conditional_returns_on_newline)
:book: This PR fixed a violation in Firefox: /Client/UIScrollViewSwizzled.swift:1:1: warning: File Name Violation: File name should match a type or extension declared in the file (if any). (file_name)
:book: This PR fixed a violation in Firefox: /Client/UIScrollViewSwizzled.swift:20:1: warning: Vertical Whitespace after Opening Braces Violation: Don't include vertical whitespace (empty line) after opening braces. (vertical_whitespace_opening_braces)
:book: This PR fixed a violation in Firefox: /Client/UIScrollViewSwizzled.swift:21:18: warning: Missing Docs Violation: public declarations should be documented. (missing_docs)
:book: This PR fixed a violation in Firefox: /Client/UIScrollViewSwizzled.swift:21:18: warning: Modifier Order Violation: public modifier should be before final. (modifier_order)
:book: This PR fixed a violation in Firefox: /Client/UIScrollViewSwizzled.swift:22:9: warning: Conditional Returns on Newline Violation: Conditional statements should always return on the next line (conditional_returns_on_newline)
:book: This PR fixed a violation in Firefox: /Client/UIScrollViewSwizzled.swift:28:11: warning: Attributes Violation: Attributes should be on their own lines in functions and types, but on the same line as variables and imports. (attributes)
:book: This PR fixed a violation in Firefox: /Client/UIScrollViewSwizzled.swift:28:11: warning: Explicit ACL Violation: All declarations should specify Access Control Level keywords explicitly. (explicit_acl)
:book: This PR fixed a violation in Firefox: /Client/UIScrollViewSwizzled.swift:29:25: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
:book: This PR fixed a violation in Firefox: /Client/UIScrollViewSwizzled.swift:29:9: warning: Explicit Type Interface Violation: Properties should have a type interface (explicit_type_interface)
:book: This PR fixed a violation in Firefox: /Client/UIScrollViewSwizzled.swift:30:27: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
:book: This PR fixed a violation in Firefox: /Client/UIScrollViewSwizzled.swift:30:9: warning: Explicit Type Interface Violation: Properties should have a type interface (explicit_type_interface)
:book: This PR fixed a violation in WordPress: /WordPress/WordPressTest/I18n.swift:5:30: warning: NSLocalizedString Key Violation: Static strings should be used as key/comment in NSLocalizedString in order for genstrings to work. (nslocalizedstring_key)

Generated by :no_entry_sign: Danger

SwiftLintBot avatar Oct 02 '21 12:10 SwiftLintBot

Sorry for the delay in reviewing this, can you please rebase, address any remaining CI failures and then ping me again for review?

jpsim avatar Nov 29 '21 18:11 jpsim