-
Notifications
You must be signed in to change notification settings - Fork 22
/
.swiftlint.yml
126 lines (105 loc) · 4.67 KB
/
.swiftlint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# Using a remote configuration fails in Xcode 15.2
#
# parent_config: https://raw.githubusercontent.com/Automattic/swiftlint-config/0f8ab6388bd8d15a04391825ab125f80cfb90704/.swiftlint.yml
# remote_timeout: 10.0
#
# Error details:
# /usr/bin/sandbox-exec -p "(version 1)
# (deny default)
# (import \"system.sb\")
# (allow file-read*)
# (allow process*)
# (allow mach-lookup (global-name \"com.apple.lsd.mapdb\"))
# (allow file-write*
# (subpath \"/private/tmp\")
# (subpath \"/private/var/folders/dq/cdqxvx3s5ps75564rpmb_dc00000gn/T\")
# )
# (deny file-write*
# (subpath \"/Users/gio/Developer/a8c/WordPress-iOS-Shared\")
# )
# (allow file-write*
# (subpath \"/Users/gio/Developer/a8c/WordPress-iOS-Shared/DerivedData/WordPress-iOS-Shared/SourcePackages/plugins/wordpress-ios-shared.output/WordPressSharedTests/SwiftLintPlugin\")
# )
# " /Users/gio/Developer/a8c/WordPress-iOS-Shared/DerivedData/WordPress-iOS-Shared/SourcePackages/artifacts/swiftlint/SwiftLintBinary/SwiftLintBinary.artifactbundle/swiftlint-0.54.0-macos/bin/swiftlint lint --quiet --force-exclude --cache-path /Users/gio/Developer/a8c/WordPress-iOS-Shared/DerivedData/WordPress-iOS-Shared/SourcePackages/plugins/wordpress-ios-shared.output/WordPressSharedTests/SwiftLintPlugin --config /Users/gio/Developer/a8c/WordPress-iOS-Shared/.swiftlint.yml /Users/gio/Developer/a8c/WordPress-iOS-Shared/Tests/WordPressSharedTests/DebouncerTests.swift <plus many other files...>
#
# While we figure that out, here is a copy of the remote configuration.
# Some of the custom rules are useless in this context, but we kept them to keep consistency for when we'll move back to it.
swiftlint_version: 0.54.0
# Project configuration
#
excluded:
- DerivedData
- fastlane
- Pods
- Scripts
# Automattic's CI caching setup may generate this in the project folder
- Users/builder/Library/Caches/CocoaPods/Pods
- vendor
- .build/ # not in original configurartion!
# Rules – Opt-in only, so we can progressively introduce new ones
#
only_rules:
# Colons should be next to the identifier when specifying a type.
- colon
# There should be no space before and one after any comma.
- comma
# if,for,while,do statements shouldn't wrap their conditionals in parentheses.
- control_statement
# Arguments can be omitted when matching enums with associated types if they
# are not used.
- empty_enum_arguments
# Prefer `() -> ` over `Void -> `.
- empty_parameters
# MARK comment should be in valid format.
- mark
# Opening braces should be preceded by a single space and on the same line as
# the declaration.
- opening_brace
# Files should have a single trailing newline.
- trailing_newline
# Lines should not have trailing semicolons.
- trailing_semicolon
# Lines should not have trailing whitespace.
- trailing_whitespace
- custom_rules
# Rules configuration
#
control_statement:
severity: error
trailing_whitespace:
ignores_empty_lines: false
ignores_comments: false
# Custom rules
#
custom_rules:
natural_content_alignment:
name: "Natural Content Alignment"
regex: '\.contentHorizontalAlignment(\s*)=(\s*)(\.left|\.right)'
message: "Forcing content alignment left or right can affect the Right-to-Left layout. Use naturalContentHorizontalAlignment instead."
severity: warning
natural_text_alignment:
name: "Natural Text Alignment"
regex: '\.textAlignment(\s*)=(\s*).left'
message: "Forcing text alignment to left can affect the Right-to-Left layout. Consider setting it to `natural`"
severity: warning
inverse_text_alignment:
name: "Inverse Text Alignment"
regex: '\.textAlignment(\s*)=(\s*).right'
message: "When forcing text alignment to the right, be sure to handle the Right-to-Left layout case properly, and then silence this warning with this line `// swiftlint:disable:next inverse_text_alignment`"
severity: warning
localization_comment:
name: "Localization Comment"
regex: 'NSLocalizedString([^,]+,\s+comment:\s*"")'
message: "Localized strings should include a description giving context for how the string is used."
severity: warning
string_interpolation_in_localized_string:
name: "String Interpolation in Localized String"
regex: 'NSLocalizedString\("[^"]*\\\(\S*\)'
message: "Localized strings must not use interpolated variables. Instead, use `String(format:`"
severity: error
swiftui_localization:
name: "SwiftUI Localization"
regex: 'LocalizedStringKey'
message: "Using `LocalizedStringKey` is incompatible with our tooling and doesn't allow you to provide a hint/context comment for translators either. Please use `NSLocalizedString` instead, even with SwiftUI code."
severity: error
excluded: '.*Widgets/.*'