You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But if MyView has generics like the code below, a lint error will still be triggered
protocol: DataObject: ObservableObject {// ...}structMyView<Object:DataObject>:View{// ...}structMyView_Preview:PreviewProvider{// ← a lint error will be triggered here// ...}
Complete output when running SwiftLint, including the stack trace and command used
$ mint run swiftlint
🌱 Finding latest version of SwiftLint
🌱 Running swiftlint 0.39.2...
Loading configuration from '.swiftlint.yml'
Linting Swift files at paths
Linting 'XXX.swift' (1/13)
Linting 'XXX.swift' (2/13)
Linting 'XXX.swift' (3/13)
Linting 'XXX.swift' (4/13)
Linting 'XXX.swift' (5/13)
Linting 'XXX.swift' (6/13)
Linting 'XXX.swift' (7/13)
Linting 'XXX.swift' (8/13)
Linting 'XXX.swift' (9/13)
Linting 'XXX.swift' (10/13)
Linting 'XXX.swift' (11/13)
Linting 'XXX.swift' (12/13)
Linting 'XXX.swift' (13/13)
Path/To/XXX.swift:148:13: warning: Closure Parameter Position Violation: Closure parameters should be on the same line as opening brace. (closure_parameter_position)
Path/To/XXX.swift:148:20: warning: Closure Parameter Position Violation: Closure parameters should be on the same line as opening brace. (closure_parameter_position)
Path/To/XXX.swift:90:82: error: Force Cast Violation: Force casts should be avoided. (force_cast)
Path/To/XXX.swift:196:29: warning: Colon Violation: Colons should be next to the identifier when specifying a type and next to the key in dictionary literals. (colon)
Path/To/XXX.swift:199:47: warning: Redundant Optional Initialization Violation: Initializing an optional variable with nil is redundant. (redundant_optional_initialization)
Path/To/XXX.swift:187:8: error: Type Name Violation: Type name should only contain alphanumeric characters: 'XXX_Preview' (type_name)
Done linting! Found 6 violations, 2 serious in 13 files.
(Replaced exact file names with XXX)
Environment
SwiftLint version (run swiftlint version to be sure)?
0.39.2
Installation method used (Homebrew, CocoaPods, building from source, etc)?
mint
Paste your configuration file:
included: # paths to ignore during linting. Takes precedence over `included`.
- XXX
- XXXTests
- XXXUITestsdisabled_rules:
- trailing_comma
- trailing_newline
- trailing_whitespace
- vertical_whitespace
- duplicate_importsidentifier_name:
max_length: 50excluded:
- i
- x
- y
- id
- on
- to
- us
- up
- at
- vc
- ciline_length:
ignores_function_declarations: trueignores_comments: truewarning: 175type_name:
max_length: 50nesting:
type_level:
warning: 2statement_level:
warning: 5function_parameter_count:
warning: 7error: 10large_tuple:
warning: 4
Are you using nested configurations?
If so, paste their relative paths and respective contents.
No
Which Xcode version are you using (check xcodebuild -version)?
Xcode 11.6
Build version 11E708
Do you have a sample that shows the issue? Run echo "[string here]" | swiftlint lint --no-cache --use-stdin --enable-all-rules
to quickly test if your example is really demonstrating the issue. If your example is more
complex, you can use swiftlint lint --path [file here] --no-cache --enable-all-rules.
protocol: DataObject: ObservableObject {// ...}structMyView<Object:DataObject>:View{// ...}// This triggers a violation:structMyView_Preview:PreviewProvider{// ...}
The text was updated successfully, but these errors were encountered:
New Issue Checklist
Describe the bug
#2791 resolved the problem with normal SwiftUI preview type names like:
But if
MyView
has generics like the code below, a lint error will still be triggeredComplete output when running SwiftLint, including the stack trace and command used
(Replaced exact file names with
XXX
)Environment
SwiftLint version (run
swiftlint version
to be sure)?0.39.2
Installation method used (Homebrew, CocoaPods, building from source, etc)?
mint
Paste your configuration file:
Are you using nested configurations?
If so, paste their relative paths and respective contents.
No
Which Xcode version are you using (check
xcodebuild -version
)?Xcode 11.6
Build version 11E708
Do you have a sample that shows the issue? Run
echo "[string here]" | swiftlint lint --no-cache --use-stdin --enable-all-rules
to quickly test if your example is really demonstrating the issue. If your example is more
complex, you can use
swiftlint lint --path [file here] --no-cache --enable-all-rules
.The text was updated successfully, but these errors were encountered: