Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Install SwiftFormat
run: |
curl -fsSL -o /tmp/swiftformat.zip \
https://github.com/nicklockwood/SwiftFormat/releases/download/0.64.5/swiftformat_linux.zip
https://github.com/nicklockwood/SwiftFormat/releases/download/0.64.6/swiftformat_linux.zip
unzip -q /tmp/swiftformat.zip -d /tmp/swiftformat
install -m 0755 /tmp/swiftformat/swiftformat_linux /usr/local/bin/swiftformat
swiftformat --version
Expand Down
1 change: 1 addition & 0 deletions .swift-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6.4
66 changes: 9 additions & 57 deletions .swiftformat
Original file line number Diff line number Diff line change
@@ -1,44 +1,29 @@
--acronyms ID,URL,UUID
--min-version 0.64.6
--allman false
--allow-partial-wrapping false
--anonymous-for-each convert
--asset-literals visual-width
--async-capturing
--before-marks
--binary-grouping 4,8
--blank-line-after-switch-case multiline-only
--call-site-paren same-line
--category-mark "MARK: %c"
--class-threshold 0
--closing-paren default
--closure-void remove
--complex-attributes preserve
--computed-var-attributes preserve
--conditional-assignment after-property
--conflict-markers reject
--date-format system
--decimal-grouping 3,6
--default-test-suite-attributes
--doc-comments before-declarations
--else-position next-line
--empty-braces no-space
--enum-namespaces always
--enum-threshold 0
--equatable-macro none
--exponent-case lowercase
--exponent-grouping disabled
--extension-acl on-declarations
--extension-mark "MARK: - %t + %c"
--extension-threshold 0
--file-macro "#file"
--fraction-grouping disabled
--fragment false
--func-attributes preserve
--generic-types
--group-blank-lines true
--grouped-extension "MARK: %c"
--guard-else auto
--guard-like-if-statements preserve
--header ignore
--hex-grouping 4,8
--hex-literal-case uppercase
Expand All @@ -48,75 +33,39 @@
--indent-blank-lines false
--indent-case false
--indent-strings false
--inferred-types always
--init-coder-nil false
--lifecycle
--line-after-marks true
--line-between-guards false
--linebreaks lf
--list-wrap-threshold none
--mark-categories true
--mark-class-threshold 0
--mark-enum-threshold 0
--mark-extension-threshold 0
--mark-extensions always
--mark-struct-threshold 0
--mark-types always
--markdown-files ignore
--max-width none
# Match SwiftLint's modifier_order rule so formatting and lint fixes agree.
--modifier-order override,nonisolated,isolated,open,public,package,internal,fileprivate,private,open(set),public(set),package(set),internal(set),fileprivate(set),private(set),dynamic,mutating,nonmutating,lazy,final,required,convenience,static,class,unowned,weak
--never-trailing
--nil-init remove
--no-space-operators
--no-wrap-operators
--non-complex-attributes
--octal-grouping 4,8
--operator-func spaced
--organization-mode visibility
--organize-types actor,class,enum,struct
--pattern-let hoist
--prefer-synthesized-init-for-internal-structs never
--preserve-acronyms
--preserve-decls
--preserved-property-types Package,CoordinateEntryRow
--property-types infer-locals-only
--ranges spaced
--redundant-async tests-only
--redundant-optional-binding same-name-only
--redundant-throws tests-only
--self init-only
--self-required
--semicolons inline-only
--short-optionals except-properties
--single-line-for-each ignore
--single-line-ternary convert
--smart-tabs enabled
--some-any true
--sort-swiftui-properties none
--sorted-patterns
--stored-var-attributes preserve
--strip-unused-args always
--struct-threshold 0
--suite-name-format preserve
--tab-width unspecified
--test-case-access-control internal
--test-case-name-format preserve
--throw-capturing
--test-case-name-format standard-identifiers
--timezone system
--trailing-closures
--trailing-commas always
--trim-whitespace always
--type-attributes prev-line
--type-blank-lines insert
--type-body-marks preserve
--type-blank-lines preserve
--type-delimiter space-after
--type-mark "MARK: - %t"
--type-marks
--type-order
--url-macro none
--visibility-marks
--visibility-order
--void-type Void
--wrap-arguments before-first
--wrap-collections before-first
Expand All @@ -129,7 +78,10 @@
--wrap-ternary before-operators
--wrap-type-aliases before-first
--xcode-indentation enabled
--xctest-symbols
--yoda-swap always
--disable trailingClosures,unusedArguments,preferExplicitFalse
--enable blankLineAfterSwitchCase,blankLinesAfterGuardStatements,blockComments,isEmpty,preferContains,preferCountWhere,preferFirstWhere,preferFlatMap,preferLazyMap,preferMinOverSorted,preferSwiftStringAPI,preferSwiftTesting,singlePropertyPerLine,sortSwitchCases,unusedPrivateDeclarations,wrapEnumCases,wrapMultilineConditionalAssignment,wrapMultilineFunctionChains
--disable trailingClosures,unusedArguments
--enable blankLineAfterSwitchCase,blankLinesAfterGuardStatements,blockComments,isEmpty,preferContains,preferCountWhere,preferFirstWhere,preferFlatMap,preferMinOverSorted,preferSwiftStringAPI,preferSwiftTesting,singlePropertyPerLine,sortSwitchCases,unusedPrivateDeclarations,wrapEnumCases,wrapMultilineConditionalAssignment,wrapMultilineFunctionChains,commonTypos,forWhere,emptyExtensions,noExplicitOwnership

# Build products, dependency checkouts and generated data. SwiftFormat
# rewrites files in place, so these must never be scanned.
--exclude .build,.swiftpm
8 changes: 4 additions & 4 deletions Tests/MapnikTests/APIHardeningTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ struct APIGapTests {

/// tileCount counts unique tiles, matching the tilelist.
@Test
func `tile count counts unique tiles`() {
func tileCountCountsUniqueTiles() {
let builder = TilelistBuilder()
builder.add(MapTile(x: 1, y: 2, z: 3))
builder.add(MapTile(x: 1, y: 2, z: 3))
Expand All @@ -21,7 +21,7 @@ struct APIGapTests {

/// Vector renders honour a requested page size.
@Test
func `vector renders honour page size`() throws {
func vectorRendersHonourPageSize() throws {
let map = try Mapnik(xml: Fixtures.polygonStyle)

let svg = try map.renderSVG(width: 400, height: 300)
Expand All @@ -35,7 +35,7 @@ struct APIGapTests {

/// Vector renders without an explicit size use the map's current size.
@Test
func `vector renders default to map size`() throws {
func vectorRendersDefaultToMapSize() throws {
let map = try Mapnik(xml: Fixtures.polygonStyle)
let svg = try map.renderSVG()
let text = String(decoding: svg, as: UTF8.self)
Expand All @@ -44,7 +44,7 @@ struct APIGapTests {

/// ImageFormat's mapnik type string is observable.
@Test
func `image format exposes type string`() {
func imageFormatExposesTypeString() {
#expect(ImageFormat.png().typeString == "png")
#expect(ImageFormat.png(colors: 64).typeString == "png:c=64")
#expect(ImageFormat.png256.typeString == "png256")
Expand Down
4 changes: 2 additions & 2 deletions Tests/MapnikTests/MapnikDatasourceTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ struct DatasourceLifetimeTests {

/// Datasources can be created, queried and destroyed concurrently.
@Test
func `concurrent datasource lifecycle is safe`() async throws {
func concurrentDatasourceLifecycleIsSafe() async throws {
try await withThrowingTaskGroup(of: Void.self) { group in
for _ in 0 ..< 8 {
group.addTask {
Expand All @@ -306,7 +306,7 @@ struct DatasourceLifetimeTests {

/// A map keeps working after the counting datasource handle is destroyed.
@Test
func `map outlives counting datasource handle`() throws {
func mapOutlivesCountingDatasourceHandle() throws {
let map = try Mapnik(xml: Fixtures.polygonStyle)
let counter = try #require(mapnik_counting_datasource_create())
defer { mapnik_counting_datasource_destroy(counter) }
Expand Down
6 changes: 2 additions & 4 deletions Tests/MapnikTests/MetatileTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -409,10 +409,8 @@ struct MetatileTests {
for tile in block.tiles {
#expect(plain.contains(tile), "tile \(tile) outside the bounding box")
}
for tile in block.blockTiles {
if plain.contains(tile) {
#expect(block.tiles.contains(tile))
}
for tile in block.blockTiles where plain.contains(tile) {
#expect(block.tiles.contains(tile))
}
}
}
Expand Down
Loading