Skip to content

Commit 755878f

Browse files
committed
Fixing Linting Issues [skip ci]
1 parent 4903492 commit 755878f

37 files changed

+532
-481
lines changed

.swift-format

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
"spaces" : 2
77
},
88
"indentConditionalCompilationBlocks" : true,
9-
"indentSwitchCaseLabels" : true,
10-
"lineBreakAroundMultilineExpressionChainComponents" : true,
11-
"lineBreakBeforeControlFlowKeywords" : true,
12-
"lineBreakBeforeEachArgument" : true,
13-
"lineBreakBeforeEachGenericRequirement" : true,
9+
"indentSwitchCaseLabels" : false,
10+
"lineBreakAroundMultilineExpressionChainComponents" : false,
11+
"lineBreakBeforeControlFlowKeywords" : false,
12+
"lineBreakBeforeEachArgument" : false,
13+
"lineBreakBeforeEachGenericRequirement" : false,
1414
"lineLength" : 100,
1515
"maximumBlankLines" : 1,
1616
"multiElementCollectionTrailingCommas" : true,
@@ -26,7 +26,7 @@
2626
"AlwaysUseLiteralForEmptyCollectionInit" : false,
2727
"AlwaysUseLowerCamelCase" : true,
2828
"AmbiguousTrailingClosureOverload" : true,
29-
"BeginDocumentationCommentWithOneLineSummary" : true,
29+
"BeginDocumentationCommentWithOneLineSummary" : false,
3030
"DoNotUseSemicolons" : true,
3131
"DontRepeatTypeInStaticProperties" : true,
3232
"FileScopedDeclarationPrivacy" : false,
@@ -42,7 +42,7 @@
4242
"NoCasesWithOnlyFallthrough" : true,
4343
"NoEmptyTrailingClosureParentheses" : true,
4444
"NoLabelsInCasePatterns" : true,
45-
"NoLeadingUnderscores" : false,
45+
"NoLeadingUnderscores" : true,
4646
"NoParensAroundConditions" : true,
4747
"NoPlaygroundLiterals" : true,
4848
"NoVoidReturnOnFunctionSignature" : true,
@@ -67,4 +67,4 @@
6767
"spacesAroundRangeFormationOperators" : false,
6868
"tabWidth" : 2,
6969
"version" : 1
70-
}
70+
}

.swiftlint.yml

Lines changed: 41 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
opt_in_rules:
22
- array_init
3-
- attributes
43
- closure_body_length
54
- closure_end_indentation
65
- closure_spacing
@@ -22,14 +21,15 @@ opt_in_rules:
2221
- explicit_acl
2322
- explicit_init
2423
- explicit_top_level_acl
25-
- fallthrough
24+
# - fallthrough
2625
- fatal_error_message
2726
- file_name
2827
- file_name_no_space
2928
- file_types_order
29+
- first_where
3030
- flatmap_over_map_reduce
3131
- force_unwrapping
32-
- function_default_parameter_at_end
32+
# - function_default_parameter_at_end
3333
- ibinspectable_in_extension
3434
- identical_operands
3535
- implicit_return
@@ -41,8 +41,9 @@ opt_in_rules:
4141
- legacy_random
4242
- literal_expression_end_indentation
4343
- lower_acl_than_parent
44-
#- missing_docs
44+
- missing_docs
4545
- modifier_order
46+
- multiline_arguments
4647
- multiline_arguments_brackets
4748
- multiline_function_chains
4849
- multiline_literal_brackets
@@ -56,7 +57,6 @@ opt_in_rules:
5657
- optional_enum_case_matching
5758
- overridden_super_call
5859
- override_in_extension
59-
- pattern_matching_keywords
6060
- prefer_self_type_over_type_of_self
6161
- prefer_zero_over_explicit_init
6262
- private_action
@@ -74,48 +74,65 @@ opt_in_rules:
7474
- sorted_first_last
7575
- sorted_imports
7676
- static_operator
77-
- strict_fileprivate
7877
- strong_iboutlet
7978
- toggle_bool
79+
# - trailing_closure
8080
- type_contents_order
8181
- unavailable_function
8282
- unneeded_parentheses_in_closure_argument
8383
- unowned_variable_capture
84+
- untyped_error_in_catch
8485
- vertical_parameter_alignment_on_call
85-
- vertical_whitespace_between_cases
8686
- vertical_whitespace_closing_braces
8787
- vertical_whitespace_opening_braces
8888
- xct_specific_matcher
8989
- yoda_condition
90-
disabled_rules:
91-
- trailing_comma
92-
- strict_fileprivate
93-
- function_default_parameter_at_end
94-
- switch_case_alignment
90+
analyzer_rules:
91+
- unused_import
92+
- unused_declaration
9593
cyclomatic_complexity:
9694
- 6
97-
- 8
98-
type_body_length:
99-
- 125
100-
- 200
95+
- 12
10196
file_length:
102-
- 250
103-
- 300
97+
warning: 225
98+
error: 300
10499
function_body_length:
105-
- 25
106-
- 35
100+
- 50
101+
- 76
107102
function_parameter_count: 8
108103
line_length:
109-
- 90
110-
- 90
104+
- 100
105+
- 200
106+
closure_body_length:
107+
- 50
108+
- 60
111109
identifier_name:
112110
excluded:
113111
- id
114-
- completeFileProtectionUntilFirstUserAuthentication
112+
- no
115113
excluded:
116114
- DerivedData
117115
- .build
118-
- .swiftpm
119116
- Mint
117+
- Examples
120118
indentation_width:
121119
indentation_width: 2
120+
file_name:
121+
severity: error
122+
fatal_error_message:
123+
severity: error
124+
disabled_rules:
125+
- nesting
126+
- implicit_getter
127+
- switch_case_alignment
128+
- closure_parameter_position
129+
- trailing_comma
130+
- opening_brace
131+
- optional_data_string_conversion
132+
- pattern_matching_keywords
133+
custom_rules:
134+
no_unchecked_sendable:
135+
name: "No Unchecked Sendable"
136+
regex: '@unchecked\s+Sendable'
137+
message: "Use proper Sendable conformance instead of @unchecked Sendable to maintain strict concurrency safety"
138+
severity: error

Mintfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
swiftlang/swift-format@600.0.0
2-
realm/SwiftLint@0.58.0
3-
peripheryapp/periphery@2.20.0
1+
swiftlang/swift-format@602.0.0
2+
realm/SwiftLint@0.62.2
3+
peripheryapp/periphery@3.2.0

Sources/RadiantDocs/CodablePackageDocument.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@
8383
configuration.existingFile ?? FileWrapper(directoryWithFileWrappers: [:])
8484

8585
if let oldConfigJSONWrapper = rootFileWrapper
86-
.fileWrappers?[T.configurationFileWrapperKey] {
86+
.fileWrappers?[T.configurationFileWrapperKey]
87+
{
8788
rootFileWrapper.removeFileWrapper(oldConfigJSONWrapper)
8889
}
8990

Sources/RadiantDocs/Primitives/FileType.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public struct FileType: Hashable, ExpressibleByStringLiteral, Sendable {
5151
/// - Parameters:
5252
/// - utIdentifier: The Uniform Type Identifier (UTI) for the file type.
5353
/// - isOwned: A boolean indicating whether the file type is owned.
54-
/// - fileExtension: The optional file extension associated with the file type.
54+
/// - fileExtension: The optional file extension associated with the file type.
5555
public init(utIdentifier: String, isOwned: Bool, fileExtension: String? = nil) {
5656
self.utIdentifier = utIdentifier
5757
self.isOwned = isOwned

Sources/RadiantDocs/Primitives/InitializablePackage.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ extension InitializablePackage {
4949
/// - Parameters:
5050
/// - fileURL: The URL at which to create the package.
5151
/// - encoder: The JSON encoder to use for encoding the package.
52-
/// - options: The options to use when creating the package. Defaults to
53-
/// `.none`.
52+
/// - options: The options to use when creating the package. Defaults to
53+
/// `.none`.
5454
///
5555
/// - Returns: The newly created instance of the package.
5656
///

Sources/RadiantDocs/Primitives/InitializablePackageOptions.swift

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
public import Foundation
3131

32+
/// Options for controlling how package files are written and protected.
3233
public struct InitializablePackageOptions: OptionSet, Sendable {
3334
/// An option to write data to an auxiliary file first and
3435
/// then replace the original file
@@ -46,10 +47,12 @@ public struct InitializablePackageOptions: OptionSet, Sendable {
4647
/// or the file is already open.
4748
public static let completeFileProtectionUnlessOpen =
4849
InitializablePackageOptions(rawValue: 1 << 4)
50+
// swiftlint:disable identifier_name
4951
/// An option to allow the file to be accessible after a user first unlocks the
5052
/// device.
5153
public static let completeFileProtectionUntilFirstUserAuthentication =
5254
InitializablePackageOptions(rawValue: 1 << 5)
55+
// swiftlint:enable identifier_name
5356
/// An option the system uses when determining the file protection options that
5457
/// the system assigns to the data.
5558
public static let fileProtectionMask = InitializablePackageOptions(rawValue: 0x0F << 2)
@@ -58,21 +61,24 @@ public struct InitializablePackageOptions: OptionSet, Sendable {
5861
public static let withIntermediateDirectories =
5962
InitializablePackageOptions(rawValue: 1 << 6)
6063
// Common combinations
64+
/// No options enabled.
6165
public static let none: InitializablePackageOptions = []
66+
/// The raw integer value representing the option set.
6267
public let rawValue: Int
6368
/// Returns true if the withIntermediateDirectories option is enabled
6469
public var withIntermediateDirectoriesIsEnabled: Bool {
6570
contains(.withIntermediateDirectories)
6671
}
72+
/// Creates an option set with the specified raw value.
73+
///
74+
/// - Parameter rawValue: The raw integer value for the option set.
6775
public init(rawValue: Int) { self.rawValue = rawValue }
6876
}
6977

7078
extension Data.WritingOptions {
7179
/// Initialize Data.WritingOptions from InitializablePackageOptions
7280
/// - Parameter options: The `InitializablePackageOptions`
73-
/// to convert to `Data.WritingOptions`
74-
/// - Returns: The `Data.WritingOptions` equivalent
75-
/// of the provided `InitializablePackageOptions`
81+
/// to convert to `Data.WritingOptions`
7682
public init(options: InitializablePackageOptions) {
7783
var dataOptions: Data.WritingOptions = []
7884
if options.contains(.atomic) { dataOptions.insert(.atomic) }

Sources/RadiantDocs/UTType.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@
5757
if fileType.isOwned { types.append(.init(exportedAs: fileType.utIdentifier)) }
5858

5959
if let fileExtensionType =
60-
fileType.fileExtension.flatMap({ UTType(filenameExtension: $0) }) {
60+
fileType.fileExtension.flatMap({ UTType(filenameExtension: $0) })
61+
{
6162
types.append(fileExtensionType)
6263
}
6364

Sources/RadiantKit/AppKit/NSWindowAdaptorModifier.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ import Foundation
5252

5353
/// Creates the `NSView` that will be used to access the underlying
5454
/// `NSWindow`.
55-
/// - Parameter context: The context provided by the SwiftUI framework.
55+
/// - Parameter _: The context provided by the SwiftUI framework.
56+
/// -
5657
/// - Returns: An `NSView` instance.
5758
fileprivate func makeNSView(context _: Self.Context) -> NSView {
5859
let view = NSView()
@@ -65,8 +66,8 @@ import Foundation
6566

6667
/// Updates the `NSView` if necessary.
6768
/// - Parameters:
68-
/// - nsView: The `NSView` to be updated.
69-
/// - context: The context provided by the SwiftUI framework.
69+
/// - _: The `NSView` to be updated.
70+
/// - _: The context provided by the SwiftUI framework.
7071
fileprivate func updateNSView(_: NSView, context _: Context) {}
7172
}
7273

@@ -110,8 +111,8 @@ import Foundation
110111
#else
111112
extension View {
112113
/// Adds a no-op `nsWindowAdaptor` modifier to the `View`.
113-
/// - Parameter callback: A closure that will be called with `Any?`, but
114-
/// does nothing.
114+
/// - Parameter _: A closure that will be called with `Any?`, but
115+
/// does nothing.
115116
/// - Returns: The original `View`.
116117
public func nsWindowAdaptor(_: @escaping (Any?) -> Void) -> some View { self }
117118
}

Sources/RadiantKit/Color.swift

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
/// An extension to the `Color` type that adds an initializer to create a
3434
/// `Color` instance from a hexadecimal string.
3535
extension Color {
36-
// swiftlint:disable function_body_length
37-
3836
/// Initializes a `Color` instance from a hexadecimal string.
3937
///
4038
/// - Parameter hex: A hexadecimal string representation of the color, in the
@@ -49,19 +47,19 @@
4947
let blue: UInt64
5048

5149
switch hex.count {
52-
case 3: // RGB (12-bit)
53-
(alpha, red, green, blue) = (
54-
255, (int >> 8) * 17, (int >> 4 & 0xF) * 17, (int & 0xF) * 17
55-
)
56-
case 6: // RGB (24-bit)
57-
(alpha, red, green, blue) =
58-
(255, int >> 16, int >> 8 & 0xFF, int & 0xFF)
59-
case 8: // ARGB (32-bit)
60-
(alpha, red, green, blue) =
61-
(int >> 24, int >> 16 & 0xFF, int >> 8 & 0xFF, int & 0xFF)
50+
case 3: // RGB (12-bit)
51+
(alpha, red, green, blue) = (
52+
255, (int >> 8) * 17, (int >> 4 & 0xF) * 17, (int & 0xF) * 17
53+
)
54+
case 6: // RGB (24-bit)
55+
(alpha, red, green, blue) =
56+
(255, int >> 16, int >> 8 & 0xFF, int & 0xFF)
57+
case 8: // ARGB (32-bit)
58+
(alpha, red, green, blue) =
59+
(int >> 24, int >> 16 & 0xFF, int >> 8 & 0xFF, int & 0xFF)
6260

63-
default:
64-
(alpha, red, green, blue) = (255, 0, 0, 0)
61+
default:
62+
(alpha, red, green, blue) = (255, 0, 0, 0)
6563
}
6664

6765
self.init(
@@ -72,6 +70,5 @@
7270
opacity: Double(alpha) / 255
7371
)
7472
}
75-
// swiftlint:enable function_body_length
7673
}
7774
#endif

0 commit comments

Comments
 (0)