Skip to content

Commit

Permalink
Merge pull request #232 from shiguredo/feature/migrate-swiftlint-to-spm
Browse files Browse the repository at this point in the history
SwiftLint を Swift Package Manager で管理する
  • Loading branch information
zztkm authored Feb 4, 2025
2 parents aeb0647 + a44306c commit cd8781c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
- @zztkm
- [UPDATE] GitHub Actions で format check をするのをやめる
- @zztkm
- [UPDATE] SwiftLint の管理を CocoaPods から Swift Package Manager に移行する
- @zztkm

## 2025.1.1

Expand Down
16 changes: 16 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"object": {
"pins": [
{
"package": "SwiftLintPlugins",
"repositoryURL": "https://github.com/SimplyDanny/SwiftLintPlugins",
"state": {
"branch": null,
"revision": "7a3d77f3dd9f91d5cea138e52c20cfceabf352de",
"version": "0.58.2"
}
}
]
},
"version": 1
}
5 changes: 5 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ let package = Package(
.library(name: "Sora", targets: ["Sora"]),
.library(name: "WebRTC", targets: ["WebRTC"]),
],
dependencies: [
// 開発用依存関係
// SwfitLint 公式で推奨されている SwfitLintPlugins を利用する
.package(url: "https://github.com/SimplyDanny/SwiftLintPlugins", from: "0.58.2")
],
targets: [
.binaryTarget(
name: "WebRTC",
Expand Down
8 changes: 2 additions & 6 deletions lint-format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@
# 未フォーマットか lint でルール違反を検出したら終了ステータス 1 を返す
# GitHub Actions では未フォーマット箇所の有無の確認に使う

PODS_ROOT=Pods
SRCROOT=.
LINT=${PODS_ROOT}/SwiftLint/swiftlint

# フォーマットリントは未フォーマットでもステータスコード 0 を返すので
# ステータスコードチェックを行わない
swift format lint -r Sora SoraTests
swift format -i -r Sora SoraTests

$LINT --fix $SRCROOT
$LINT --strict $SRCROOT
swift package plugin --allow-writing-to-package-directory swiftlint --fix .
swift package plugin --allow-writing-to-package-directory swiftlint --strict .
lint=$?

test $lint -eq 0
Expand Down

0 comments on commit cd8781c

Please sign in to comment.