Skip to content

Commit a648c57

Browse files
Apply standard Swift package configuration
1 parent eb8ac90 commit a648c57

3 files changed

Lines changed: 6 additions & 226 deletions

File tree

.github/workflows/swift.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ jobs:
2020
steps:
2121
- name: Checkout source
2222
uses: actions/checkout@v6
23-
- name: Download swiftlint binary
23+
- name: Resolve package dependencies
2424
run: swift package resolve
2525
- name: Lint
2626
run: >
27-
"$(find ".build/artifacts/swiftlint" -path "*macos*" -type f -name swiftlint -perm +111 -print -quit)"
27+
swift package plugin --allow-writing-to-package-directory swiftlint --
2828
lint --strict --reporter github-actions-logging
2929
- name: Resolve package dependencies
3030
run: xcodebuild -resolvePackageDependencies
@@ -41,3 +41,4 @@ jobs:
4141
test-without-building
4242
-scheme "Layout-Package"
4343
-destination "name=$SIMULATOR,OS=latest"
44+
run: swift test -v

.swiftlint-rules.yml

Lines changed: 0 additions & 222 deletions
Original file line numberDiff line numberDiff line change
@@ -1,248 +1,26 @@
11
analyzer_rules:
2-
- capture_variable
32
# - explicit_self
4-
- typesafe_array_init
53
# - unused_declaration
6-
- unused_import
74

85
only_rules:
9-
- accessibility_label_for_image
10-
- accessibility_trait_for_button
11-
- anonymous_argument_in_multiline_closure
12-
- array_init
13-
- async_without_await
14-
- attribute_name_spacing
156
# - attributes
16-
- balanced_xctest_lifecycle
17-
- blanket_disable_command
18-
- block_based_kvo
19-
- class_delegate_protocol
20-
- closing_brace
21-
- closure_body_length
22-
- closure_end_indentation
23-
- closure_parameter_position
24-
- closure_spacing
25-
- collection_alignment
26-
- colon
27-
- comma
28-
- comma_inheritance
29-
- comment_spacing
30-
- compiler_protocol_init
31-
- computed_accessors_order
32-
- conditional_returns_on_newline
33-
- contains_over_filter_count
34-
- contains_over_filter_is_empty
35-
- contains_over_first_not_nil
36-
- contains_over_range_nil_comparison
377
# - contrasted_opening_brace
38-
- control_statement
39-
- convenience_type
40-
- custom_rules
41-
- cyclomatic_complexity
42-
- deployment_target
43-
- direct_return
44-
- discarded_notification_center_observer
45-
- discouraged_assert
46-
- discouraged_direct_init
47-
- discouraged_none_name
48-
- discouraged_object_literal
49-
- discouraged_optional_boolean
50-
- discouraged_optional_collection
51-
- duplicate_conditions
52-
- duplicate_enum_cases
53-
- duplicate_imports
54-
- duplicated_key_in_dictionary_literal
55-
- dynamic_inline
56-
- empty_collection_literal
57-
- empty_count
58-
- empty_enum_arguments
59-
- empty_parameters
60-
- empty_parentheses_with_trailing_closure
61-
- empty_string
62-
- empty_xctest_method
63-
- enum_case_associated_values_count
64-
- expiring_todo
65-
- explicit_acl
66-
- explicit_enum_raw_value
67-
- explicit_init
68-
- explicit_top_level_acl
69-
- explicit_type_interface
708
# - extension_access_modifier
71-
- fallthrough
72-
- fatal_error_message
73-
- file_header
74-
- file_length
75-
- file_name
76-
- file_name_no_space
77-
- file_types_order
78-
- final_test_case
79-
- first_where
80-
- flatmap_over_map_reduce
81-
- for_where
82-
- force_cast
83-
- force_try
84-
- force_unwrapping
85-
- function_body_length
86-
- function_default_parameter_at_end
87-
- function_parameter_count
88-
- generic_type_name
899
- given_when_then # custom_rule
90-
- ibinspectable_in_extension
91-
- identical_operands
92-
- identifier_name
93-
- implicit_getter
94-
- implicit_return
95-
- implicitly_unwrapped_optional
96-
- inclusive_language
9710
# - indentation_width
98-
- invalid_swiftlint_command
99-
- is_disjoint
100-
- joined_default_parameter
101-
- large_tuple
102-
- last_where
103-
- leading_whitespace
104-
- legacy_cggeometry_functions
105-
- legacy_constant
106-
- legacy_constructor
107-
- legacy_hashing
108-
- legacy_multiple
109-
- legacy_nsgeometry_functions
110-
- legacy_objc_type
111-
- legacy_random
112-
- let_var_whitespace
113-
- line_length
114-
- literal_expression_end_indentation
115-
- local_doc_comment
116-
- lower_acl_than_parent
117-
- mark
11811
# - missing_docs
119-
- modifier_order
120-
- multiline_arguments
12112
# - multiline_arguments_brackets
122-
- multiline_function_chains
123-
- multiline_literal_brackets
124-
- multiline_parameters
125-
- multiline_parameters_brackets
126-
- multiple_closures_with_trailing_closure
127-
- nesting
128-
- nimble_operator
12913
# - no_empty_block
130-
- no_extension_access_modifier
131-
- no_fallthrough_only
132-
- no_grouping_extension
13314
# - no_magic_numbers
134-
- no_space_in_method_call
135-
- non_optional_string_data_conversion
136-
- non_overridable_class_declaration
137-
- notification_center_detachment
138-
- ns_number_init_as_function_reference
139-
- nslocalizedstring_key
140-
- nslocalizedstring_require_bundle
141-
- nsobject_prefer_isequal
142-
- number_separator
14315
# - object_literal
14416
# - one_declaration_per_file
145-
- opening_brace
146-
- operator_usage_whitespace
147-
- operator_whitespace
148-
- optional_data_string_conversion
149-
- optional_enum_case_matching
150-
- orphaned_doc_comment
151-
- overridden_super_call
152-
- override_in_extension
153-
- pattern_matching_keywords
154-
- period_spacing
155-
- prefer_key_path
156-
- prefer_nimble
157-
- prefer_self_in_static_references
158-
- prefer_self_type_over_type_of_self
159-
- prefer_type_checking
160-
- prefer_zero_over_explicit_init
16117
# - prefixed_toplevel_constant
162-
- private_action
163-
- private_outlet
164-
- private_over_fileprivate
165-
- private_subject
166-
- private_swiftui_state
167-
- private_unit_test
168-
- prohibited_interface_builder
169-
- prohibited_super_call
170-
- protocol_property_accessors_order
171-
- quick_discouraged_call
172-
- quick_discouraged_focused_test
173-
- quick_discouraged_pending_test
174-
- raw_value_for_camel_cased_codable_enum
175-
- reduce_boolean
176-
- reduce_into
177-
- redundant_discardable_let
178-
- redundant_nil_coalescing
179-
- redundant_objc_attribute
180-
- redundant_optional_initialization
181-
- redundant_self_in_closure
182-
- redundant_sendable
183-
- redundant_set_access_control
18418
# - redundant_string_enum_value
185-
- redundant_type_annotation
186-
- redundant_void_return
18719
# - required_deinit
188-
- required_enum_case
189-
- return_arrow_whitespace
19020
# - return_value_from_void_function
191-
- self_binding
192-
- self_in_property_initialization
19321
# - shorthand_argument
194-
- shorthand_operator
195-
- shorthand_optional_binding
196-
- single_test_class
19722
# - sorted_enum_cases
198-
- sorted_first_last
199-
- sorted_imports
200-
- statement_position
201-
- static_operator
202-
- static_over_final_class
203-
- strict_fileprivate
204-
- strong_iboutlet
205-
- superfluous_disable_command
206-
- superfluous_else
207-
- switch_case_alignment
208-
- switch_case_on_newline
209-
- syntactic_sugar
210-
- test_case_accessibility
211-
- todo
212-
- toggle_bool
213-
- trailing_closure
214-
- trailing_comma
215-
- trailing_newline
216-
- trailing_semicolon
217-
- trailing_whitespace
218-
- type_body_length
219-
- type_contents_order
220-
- type_name
221-
- unavailable_condition
222-
- unavailable_function
223-
- unhandled_throwing_task
224-
- unneeded_break_in_switch
22523
# - unneeded_override
226-
- unneeded_parentheses_in_closure_argument
227-
- unneeded_synthesized_initializer
228-
- unowned_variable_capture
229-
- untyped_error_in_catch
230-
- unused_closure_parameter
231-
- unused_control_flow_label
232-
- unused_enumerated
233-
- unused_optional_binding
234-
- unused_parameter
235-
- unused_setter_value
236-
- valid_ibinspectable
237-
- vertical_parameter_alignment
238-
- vertical_parameter_alignment_on_call
239-
- vertical_whitespace
24024
# - vertical_whitespace_between_cases
24125
# - vertical_whitespace_closing_braces
24226
# - vertical_whitespace_opening_braces
243-
- void_function_in_ternary
244-
- void_return
245-
- weak_delegate
246-
- xct_specific_matcher
247-
- xctfail_message
248-
- yoda_condition

Package.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ let package = Package(
2424
],
2525
dependencies: [
2626
.package(
27-
url: "https://github.com/realm/SwiftLint.git",
27+
url: "https://github.com/SimplyDanny/SwiftLintPlugins.git",
2828
exact: "0.59.1"),
2929
.package(
3030
url: "https://github.com/Quick/Nimble.git",
@@ -62,6 +62,7 @@ package.targets.forEach { target in
6262
.regular,
6363
.test,
6464
.executable,
65+
.macro,
6566
]
6667

6768
guard types.contains(target.type)
@@ -78,7 +79,7 @@ package.targets.forEach { target in
7879

7980
if enableSwiftLintBuildToolPlugin {
8081
target.plugins = (target.plugins ?? []) + [
81-
.plugin(name: "SwiftLintBuildToolPlugin", package: "SwiftLint"),
82+
.plugin(name: "SwiftLintBuildToolPlugin", package: "SwiftLintPlugins"),
8283
]
8384
}
8485
}

0 commit comments

Comments
 (0)