Skip to content

Commit 6f1a2da

Browse files
committed
Migration
1 parent 9662146 commit 6f1a2da

62 files changed

Lines changed: 2869 additions & 14 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/pull-request.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Pull request
2+
on: pull_request
3+
4+
jobs:
5+
build:
6+
runs-on: macos-15
7+
8+
steps:
9+
- uses: actions/checkout@v4
10+
11+
- name: Setup
12+
env:
13+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14+
run: |
15+
echo "GITHUB_TOKEN=${{ env.GITHUB_TOKEN }}" >> $GITHUB_ENV
16+
curl https://mise.run | sh
17+
mise install
18+
19+
- name: Lint
20+
run: mise lint
21+
22+
- name: Build
23+
run: swift build
24+
25+
- name: Test
26+
run: swift test

.mise.toml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
[vars]
2+
sources = "Sources"
3+
tests = "Tests"
4+
swiftlint = '~/.local/bin/mise x -- swiftlint'
5+
swiftformat = '~/.local/bin/mise x -- swiftformat'
6+
7+
[tools]
8+
swiftlint = "0.58.2"
9+
swiftformat = "0.55.5"
10+
11+
[tasks.lint]
12+
description = 'Run all linters'
13+
depends = ["swiftlint:*", "swiftformat"]
14+
15+
[tasks."swiftlint:sources"]
16+
description = 'Run SwiftLint for source files'
17+
quiet = true
18+
run = """
19+
{{ vars.swiftlint }} lint \
20+
--config .swiftlint.yml \
21+
--reporter relative-path \
22+
--strict \
23+
{{ vars.sources }}
24+
"""
25+
26+
[tasks."swiftlint:tests"]
27+
description = 'Run SwiftLint for test files'
28+
quiet = true
29+
run = """
30+
{{ vars.swiftlint }} lint \
31+
--config .swiftlint.yml \
32+
--config .swiftlint.tests.yml \
33+
--reporter relative-path \
34+
--strict \
35+
{{ vars.tests }}
36+
"""
37+
38+
[tasks.swiftformat]
39+
description = 'Run SwiftFormat for all files'
40+
quiet = true
41+
run = "{{ vars.swiftformat }} . --lint"

.swift-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6.0

.swiftformat

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
--acronyms ID,URL,UUID
2+
--allman false
3+
--anonymousforeach convert
4+
--assetliterals visual-width
5+
--asynccapturing
6+
--beforemarks
7+
--binarygrouping 4,8
8+
--callsiteparen default
9+
--categorymark "MARK: %c"
10+
--classthreshold 0
11+
--closingparen default
12+
--closurevoid remove
13+
--commas inline
14+
--complexattrs prev-line
15+
--computedvarattrs prev-line
16+
--condassignment always
17+
--conflictmarkers reject
18+
--dateformat system
19+
--decimalgrouping 3,6
20+
--doccomments before-declarations
21+
--elseposition same-line
22+
--emptybraces no-space
23+
--enumnamespaces always
24+
--enumthreshold 0
25+
--exponentcase lowercase
26+
--exponentgrouping disabled
27+
--extensionacl on-declarations
28+
--extensionlength 0
29+
--extensionmark "MARK: - %t + %c"
30+
--fractiongrouping disabled
31+
--fragment false
32+
--funcattributes prev-line
33+
--generictypes
34+
--groupblanklines true
35+
--groupedextension "MARK: %c"
36+
--guardelse next-line
37+
--header ignore
38+
--hexgrouping 4,8
39+
--hexliteralcase uppercase
40+
--ifdef indent
41+
--importgrouping testable-first
42+
--indent 4
43+
--indentcase false
44+
--indentstrings false
45+
--inferredtypes always
46+
--initcodernil false
47+
--inlinedforeach ignore
48+
--lifecycle
49+
--lineaftermarks true
50+
--linebreaks lf
51+
--markcategories true
52+
--markextensions always
53+
--marktypes always
54+
--maxwidth none
55+
--modifierorder
56+
--nevertrailing
57+
--nilinit remove
58+
--noncomplexattrs
59+
--nospaceoperators
60+
--nowrapoperators
61+
--octalgrouping 4,8
62+
--operatorfunc spaced
63+
--organizationmode visibility
64+
--organizetypes actor,class,enum,struct
65+
--patternlet hoist
66+
--preservedecls
67+
--preservedsymbols Package
68+
--propertytypes inferred
69+
--ranges spaced
70+
--self init-only
71+
--selfrequired
72+
--semicolons inline
73+
--shortoptionals always
74+
--smarttabs enabled
75+
--someany true
76+
--sortedpatterns
77+
--storedvarattrs prev-line
78+
--stripunusedargs always
79+
--structthreshold 0
80+
--tabwidth unspecified
81+
--throwcapturing
82+
--timezone system
83+
--trailingclosures
84+
--trimwhitespace always
85+
--typeattributes prev-line
86+
--typeblanklines preserve
87+
--typedelimiter space-after
88+
--typemark "MARK: - %t"
89+
--typemarks
90+
--typeorder
91+
--visibilitymarks
92+
--visibilityorder
93+
--voidtype void
94+
--wraparguments before-first
95+
--wrapcollections before-first
96+
--wrapconditions after-first
97+
--wrapeffects preserve
98+
--wrapenumcases always
99+
--wrapparameters before-first
100+
--wrapreturntype preserve
101+
--wrapternary before-operators
102+
--wraptypealiases after-first
103+
--xcodeindentation enabled
104+
--yodaswap always
105+
--disable enumNamespaces,fileHeader,headerFileName,redundantInternal,wrap,wrapMultilineStatementBraces,wrapSingleLineComments
106+
--enable acronyms,blankLinesBetweenImports,blockComments,docComments,isEmpty,propertyTypes,redundantProperty,sortSwitchCases,unusedPrivateDeclarations,wrapConditionalBodies,wrapEnumCases

.swiftlint.tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
disabled_rules:
2+
- no_magic_numbers

.swiftlint.yml

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
disabled_rules:
2+
- trailing_whitespace
3+
- trailing_newline
4+
5+
opt_in_rules:
6+
# accessibility_label_for_image
7+
- accessibility_trait_for_button
8+
- anonymous_argument_in_multiline_closure
9+
- array_init
10+
# async_without_await - not recognized
11+
# attributes
12+
# balanced_xctest_lifecycle
13+
# closure_body_length
14+
- closure_end_indentation
15+
- closure_spacing
16+
- collection_alignment
17+
- comma_inheritance
18+
- conditional_returns_on_newline
19+
- contains_over_filter_count
20+
- contains_over_filter_is_empty
21+
- contains_over_first_not_nil
22+
- contains_over_range_nil_comparison
23+
# contrasted_opening_brace
24+
# convenience_type - not working with Testing framework
25+
- direct_return
26+
- discarded_notification_center_observer
27+
- discouraged_assert
28+
- discouraged_none_name
29+
- discouraged_object_literal
30+
- discouraged_optional_boolean
31+
- discouraged_optional_collection
32+
- empty_collection_literal
33+
- empty_count
34+
- empty_string
35+
- empty_xctest_method
36+
- enum_case_associated_values_count
37+
# expiring_todo
38+
# explicit_acl
39+
# explicit_enum_raw_value
40+
- explicit_init
41+
- explicit_top_level_acl
42+
# explicit_type_interface
43+
# extension_access_modifier
44+
- fallthrough
45+
- fatal_error_message
46+
- file_header
47+
- file_name
48+
- file_name_no_space
49+
- file_types_order
50+
- final_test_case
51+
- first_where
52+
- flatmap_over_map_reduce
53+
- force_unwrapping
54+
# function_default_parameter_at_end
55+
- ibinspectable_in_extension
56+
- identical_operands
57+
- implicit_return
58+
# implicitly_unwrapped_optional
59+
# indentation_width
60+
- joined_default_parameter
61+
- last_where
62+
- legacy_multiple
63+
- legacy_objc_type
64+
- let_var_whitespace
65+
- literal_expression_end_indentation
66+
- local_doc_comment
67+
- lower_acl_than_parent
68+
# missing_docs
69+
# modifier_order
70+
- multiline_arguments
71+
- multiline_arguments_brackets
72+
- multiline_function_chains
73+
- multiline_literal_brackets
74+
- multiline_parameters
75+
- multiline_parameters_brackets
76+
- nimble_operator
77+
- no_empty_block
78+
- no_extension_access_modifier
79+
# no_grouping_extension
80+
- no_magic_numbers
81+
- non_overridable_class_declaration
82+
- nslocalizedstring_key
83+
- nslocalizedstring_require_bundle
84+
- number_separator
85+
- object_literal
86+
# one_declaration_per_file
87+
- operator_usage_whitespace
88+
- optional_enum_case_matching
89+
- overridden_super_call
90+
- override_in_extension
91+
- pattern_matching_keywords
92+
- period_spacing
93+
- prefer_key_path
94+
# prefer_nimble
95+
- prefer_self_in_static_references
96+
- prefer_self_type_over_type_of_self
97+
- prefer_zero_over_explicit_init
98+
- prefixed_toplevel_constant
99+
- private_action
100+
- private_outlet
101+
- private_subject
102+
- private_swiftui_state
103+
- prohibited_interface_builder
104+
- prohibited_super_call
105+
- quick_discouraged_call
106+
- quick_discouraged_focused_test
107+
- quick_discouraged_pending_test
108+
- raw_value_for_camel_cased_codable_enum
109+
- reduce_into
110+
- redundant_nil_coalescing
111+
- redundant_self_in_closure
112+
- redundant_type_annotation
113+
# required_deinit
114+
- required_enum_case
115+
- return_value_from_void_function
116+
- self_binding
117+
- shorthand_argument
118+
- shorthand_optional_binding
119+
- single_test_class
120+
# sorted_enum_cases
121+
- sorted_first_last
122+
# sorted_imports
123+
- static_operator
124+
# strict_fileprivate
125+
- strong_iboutlet
126+
- superfluous_else
127+
- switch_case_on_newline
128+
- test_case_accessibility
129+
- toggle_bool
130+
# trailing_closure
131+
- type_contents_order
132+
- unavailable_function
133+
- unhandled_throwing_task
134+
- unneeded_parentheses_in_closure_argument
135+
- unowned_variable_capture
136+
- untyped_error_in_catch
137+
- unused_parameter
138+
- vertical_parameter_alignment_on_call
139+
# vertical_whitespace_between_cases
140+
# vertical_whitespace_closing_braces
141+
# vertical_whitespace_opening_braces
142+
- weak_delegate
143+
- xct_specific_matcher
144+
# yoda_condition
145+
146+
analyzer_rules:
147+
- capture_variable
148+
# explicit_self
149+
- typesafe_array_init
150+
- unused_declaration
151+
- unused_import
152+
153+
file_header:
154+
required_pattern: |
155+
//
156+
// SWIFTLINT_CURRENT_FILENAME
157+
// PrincipleMacros
158+
//
159+
// Created by .+ on \d{2}/\d{2}/\d{4}\.
160+
// Copyright © \d{4} .+\. All rights reserved\.
161+
//
162+
163+
file_length:
164+
warning: 500
165+
166+
identifier_name:
167+
excluded: [id, x, y, z]
168+
169+
nesting:
170+
type_level: 2
171+
172+
type_name:
173+
allowed_symbols: ["_"]
174+
max_length: 50
175+
176+
type_contents_order:
177+
order: [[case], [type_alias, associated_type], [subtype], [type_property], [instance_property], [ib_inspectable], [ib_outlet], [initializer], [deinitializer], [type_method], [view_life_cycle_method], [ib_action, ib_segue_action], [other_method], [subscript]]
178+
179+
custom_rules:
180+
global_actor_attribute_order:
181+
name: "Global actor attribute order"
182+
message: "Global actor should be the first attribute."
183+
regex: "(?-s)(@.+[^,\\s]\\s+@.*Actor)"
184+
sendable_attribute_order:
185+
name: "Sendable attribute order"
186+
message: "Sendable should be the first attribute."
187+
regex: "(?-s)(@.+[^,\\s]\\s+@Sendable)"
188+
autoclosure_attribute_order:
189+
name: "Autoclosure attribute order"
190+
message: "Autoclosure should be the last attribute."
191+
regex: "(?-s)(@autoclosure\\s+@.+)"
192+
empty_line_after_type_declaration:
193+
name: "Empty line after type declaration"
194+
message: "Type declaration should start with an empty line."
195+
regex: "( |^)(actor|class|struct|enum|protocol|extension) (?!var)[^\\{]*? \\{(?!\\}) *\\n? *\\S"

0 commit comments

Comments
 (0)