Skip to content

Commit

Permalink
refactor: Lint Swift (#1613)
Browse files Browse the repository at this point in the history
# Description

Closes #1587
  • Loading branch information
Gustl22 committed Aug 22, 2023
1 parent 0539466 commit 737aa94
Show file tree
Hide file tree
Showing 11 changed files with 792 additions and 693 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/test.yml
Expand Up @@ -108,6 +108,13 @@ jobs:
DEFAULT_BRANCH: main
VALIDATE_KOTLIN_ANDROID: true
VALIDATE_CLANG_FORMAT: true
- name: Lint Swift
# TODO: check if swift-format can be integrated in super-linter, as soon as Alpine is supported
# https://github.com/apple/swift-docker/issues/231
# https://github.com/super-linter/super-linter/pull/4568
run: |
docker run --rm --workdir=/work --volume=$PWD:/work mtgto/swift-format:5.8 \
lint --parallel --strict --recursive packages/audioplayers_darwin
web:
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions .swift-format
@@ -0,0 +1,4 @@
{
"_comment": "details can be found at: https://github.com/apple/swift-format/blob/main/Documentation/Configuration.md",
"version": 1
}
6 changes: 5 additions & 1 deletion contributing.md
Expand Up @@ -136,7 +136,11 @@ Once your feature got approved to start developing, feel free to send your PRs!

* Start your PR title with a [conventional commit](https://www.conventionalcommits.org) type (feat:, fix: etc).
* Your build must pass. Please make sure everything is green!
* Follow guidelines. For the Dart side, follow [Flame's official style guide](https://github.com/flame-engine/flame/blob/main/doc/development/style_guide.md). We don't have a code analyzer for the native side (yet!), but please follow the code around you to make it properly formatted and linted. There is nothing worse than badly formatted code!
* Follow guidelines. For the Dart side, follow [Flame's official style guide](https://github.com/flame-engine/flame/blob/main/doc/development/style_guide.md).
We also provide code linting and formatting for the native side, where we take the [Flutter's formatting](https://github.com/flutter/packages/blob/main/script/tool/lib/src/format_command.dart) as reference:
* C/C++: [Chromium coding style](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/styleguide/c++/c++.md) via [clang-format](https://clang.llvm.org/docs/ClangFormatStyleOptions.html), available for [CLion](https://www.jetbrains.com/help/clion/clangformat-as-alternative-formatter.html) and [VSCode](https://code.visualstudio.com/docs/cpp/cpp-ide#_code-formatting)
* Kotlin: [Kotlin style guide](https://developer.android.com/kotlin/style-guide) via [ktlint](https://github.com/pinterest/ktlint) and [EditorConfig](https://editorconfig.org/), available for [IntelliJ](https://www.jetbrains.com/help/idea/editorconfig.html) and [VSCode](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig)
* Swift: [Google Swift Style Guide](https://google.github.io/swift/) via [swift-format](https://github.com/apple/swift-format), available for [VSCode](https://marketplace.visualstudio.com/items?itemName=vknabel.vscode-apple-swift-format) or CLI with [native installation](https://github.com/apple/swift-format#getting-swift-format) or [Docker](https://github.com/mtgto/docker-swift-format/tree/main)
* Write clean, beautiful and easy to understand code, with comments if necessary and docs if applicable.
* Update our README/getting started/feature parity table/any other docs accordingly to your change, making it clear which platforms are supported.
* Try to support all platforms where it makes sense. This is a hard thing to ask, and we understand and we will merge PRs that only work on one platform as well. But if you have the time, please help us with feature parity.
Expand Down
14 changes: 7 additions & 7 deletions packages/audioplayers/example/ios/Podfile.lock
Expand Up @@ -41,10 +41,10 @@ PODS:
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- SDWebImage (5.13.4):
- SDWebImage/Core (= 5.13.4)
- SDWebImage/Core (5.13.4)
- SwiftyGif (5.4.3)
- SDWebImage (5.17.0):
- SDWebImage/Core (= 5.17.0)
- SDWebImage/Core (5.17.0)
- SwiftyGif (5.4.4)

DEPENDENCIES:
- audioplayers_darwin (from `.symlinks/plugins/audioplayers_darwin/ios`)
Expand Down Expand Up @@ -79,9 +79,9 @@ SPEC CHECKSUMS:
file_picker: ce3938a0df3cc1ef404671531facef740d03f920
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
integration_test: 13825b8a9334a850581300559b8839134b124670
path_provider_foundation: c68054786f1b4f3343858c1e1d0caaded73f0be9
SDWebImage: e5cc87bf736e60f49592f307bdf9e157189298a3
SwiftyGif: 6c3eafd0ce693cad58bb63d2b2fb9bacb8552780
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
SDWebImage: 750adf017a315a280c60fde706ab1e552a3ae4e9
SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f

PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3

Expand Down
2 changes: 1 addition & 1 deletion packages/audioplayers/example/ios/Runner/AppDelegate.swift
@@ -1,5 +1,5 @@
import UIKit
import Flutter
import UIKit

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
Expand Down
2 changes: 1 addition & 1 deletion packages/audioplayers/example/macos/Podfile.lock
Expand Up @@ -22,7 +22,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
audioplayers_darwin: dcad41de4fbd0099cb3749f7ab3b0cb8f70b810c
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
path_provider_foundation: c68054786f1b4f3343858c1e1d0caaded73f0be9
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943

PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7

Expand Down

0 comments on commit 737aa94

Please sign in to comment.