File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# SwiftLint: https://github.com/realm/SwiftLint
22# Run `make lint` (requires SwiftLint: `brew install swiftlint`).
3+ # `make lint` passes `--strict` so warnings fail CI (avoid `swiftlint --fix` without review).
34
45excluded :
56 - build
@@ -10,8 +11,34 @@ excluded:
1011disabled_rules :
1112 # Short names are common in tight loops, parsers, and indices.
1213 - identifier_name
13- # App has a few intentional `try!` sites; prefer fixing over silencing long-term.
14- - force_try
14+
15+ # Curated opt-in rules (omit closure_end_indentation: very noisy for nested SwiftUI).
16+ opt_in_rules :
17+ - closure_spacing
18+ - empty_count
19+ - empty_enum_arguments
20+ - empty_string
21+ - explicit_init
22+ - fatal_error_message
23+ - first_where
24+ - identical_operands
25+ - legacy_multiple
26+ - literal_expression_end_indentation
27+ - operator_usage_whitespace
28+ - overridden_super_call
29+ - pattern_matching_keywords
30+ - private_action
31+ - private_outlet
32+ - prohibited_super_call
33+ - redundant_nil_coalescing
34+ - redundant_type_annotation
35+ - sorted_first_last
36+ - static_operator
37+ - toggle_bool
38+ - unavailable_function
39+ - unneeded_parentheses_in_closure_argument
40+ - weak_delegate
41+ - yoda_condition
1542
1643line_length :
1744 # Match error so long literals in fixtures do not warn; errors still cap runaway lines.
Original file line number Diff line number Diff line change @@ -488,7 +488,7 @@ extension ClipboardTransform {
488488 let headerRow = rows [ 0 ]
489489 let dataRows = Array ( rows. dropFirst ( ) )
490490
491- let sortedData = dataRows. enumerated ( ) . sorted { ( a, b) in
491+ let sortedData = dataRows. enumerated ( ) . sorted { a, b in
492492 let valueA = columnIndex < a. element. count ? a. element [ columnIndex] : " "
493493 let valueB = columnIndex < b. element. count ? b. element [ columnIndex] : " "
494494
Original file line number Diff line number Diff line change @@ -80,7 +80,13 @@ struct EditorWindowRoot: View {
8080}
8181
8282#Preview {
83- let container = try ! ModelContainer ( for: Snippet . self, configurations: . init( isStoredInMemoryOnly: true ) )
83+ let container : ModelContainer = {
84+ do {
85+ return try ModelContainer ( for: Snippet . self, configurations: . init( isStoredInMemoryOnly: true ) )
86+ } catch {
87+ fatalError ( " Preview ModelContainer failed: \( error) " )
88+ }
89+ } ( )
8490 EditorWindowRoot ( )
8591 . environmentObject ( EditorStore ( ) )
8692 . environmentObject ( SnippetsStore ( container: container) )
Original file line number Diff line number Diff line change @@ -2183,7 +2183,13 @@ extension View {
21832183}
21842184
21852185#Preview {
2186- let container = try ! ModelContainer ( for: Snippet . self, configurations: . init( isStoredInMemoryOnly: true ) )
2186+ let container : ModelContainer = {
2187+ do {
2188+ return try ModelContainer ( for: Snippet . self, configurations: . init( isStoredInMemoryOnly: true ) )
2189+ } catch {
2190+ fatalError ( " Preview ModelContainer failed: \( error) " )
2191+ }
2192+ } ( )
21872193 MenuBarView ( )
21882194 . environmentObject ( EditorStore ( ) )
21892195 . environmentObject ( SnippetsStore ( container: container) )
Original file line number Diff line number Diff line change 1- .PHONY : build build-release-unsigned generate-appicons lint test clean generate-build-info
1+ .PHONY : build build-release-unsigned generate-appicons lint lint-fix-safe test clean generate-build-info
22
33# SwiftLint: https://github.com/realm/SwiftLint — `brew install swiftlint`
44SWIFTLINT ?= $(shell command -v swiftlint 2>/dev/null)
88 echo " SwiftLint not found. Install with: brew install swiftlint" >&2 ; \
99 exit 1; \
1010 fi
11- @" $( SWIFTLINT) " lint
11+ @" $( SWIFTLINT) " lint --strict
12+
13+ # Autocorrect only low-risk rules (whitespace / file hygiene). Still review `git diff` and run tests.
14+ # Optional: pass paths, e.g. `make lint-fix-safe FIX_PATHS="ClipboardEnvy/Foo.swift"`
15+ FIX_PATHS ?= ClipboardEnvy ClipboardEnvyTests scripts
16+ lint-fix-safe :
17+ @if [ -z " $( SWIFTLINT) " ]; then \
18+ echo " SwiftLint not found. Install with: brew install swiftlint" >&2 ; \
19+ exit 1; \
20+ fi
21+ @" $( SWIFTLINT) " lint --fix \
22+ --only-rule trailing_whitespace \
23+ --only-rule trailing_newline \
24+ --only-rule leading_whitespace \
25+ --only-rule trailing_semicolon \
26+ $(FIX_PATHS )
1227
1328clean :
1429 @rm -rf build dist ; rm -rf ~ /Library/Developer/Xcode/DerivedData/ClipboardEnvy-*
You can’t perform that action at this time.
0 commit comments