Skip to content

Commit

Permalink
Add linting task
Browse files Browse the repository at this point in the history
  • Loading branch information
r-dent committed Feb 19, 2024
1 parent 8cd3094 commit 6257190
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 12 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/build-and-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "Lint"
run-name: Linting
on:
push: # pull_request
paths:
- '.github/workflows/swiftlint.yml'
- '.swiftlint.yml'
- '**/*.swift'
jobs:
SwiftLint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: GitHub Action for SwiftLint
uses: norio-nomura/[email protected]
4 changes: 2 additions & 2 deletions .github/workflows/deploy-documentation.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "Build documentation page"
run-name: ${{ github.actor }} is building SDK documentation
name: "Deploy API documentation"
run-name: Deploying API documentation
on: [workflow_dispatch]
jobs:
build-documentation-page:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: "Run tests"
run-name: ${{ github.actor }} is running tests
on: [push]
run-name: Running tests
on: [pull_request]
jobs:
run-tests:
runs-on: macos-14
Expand Down
5 changes: 5 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
opt_in_rules:
- overridden_super_call

disabled_rules:
- identifier_name
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// StreamDeckKit_ExampleApp.swift
// StreamDeckKitExampleApp.swift
// StreamDeckKit Example
//
// Created by Roman Schlagowsky on 28.12.23.
Expand All @@ -9,7 +9,7 @@ import SwiftUI
import StreamDeckKit

@main
struct StreamDeckKit_ExampleApp: App {
struct StreamDeckKitExampleApp: App {
var body: some Scene {
WindowGroup {
ContentView()
Expand All @@ -19,8 +19,8 @@ struct StreamDeckKit_ExampleApp: App {

var emojis: [String] = {
var res = [String]()
for i in 0x1F600 ... 0x1F64F {
res.append(String(UnicodeScalar(i) ?? "-"))
for index in 0x1F600 ... 0x1F64F {
res.append(String(UnicodeScalar(index) ?? "-"))
}
return res
}()
33 changes: 29 additions & 4 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

/* Begin PBXBuildFile section */
30303E232B6CDEF500DC3084 /* StreamDeckLayoutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30303E222B6CDEF500DC3084 /* StreamDeckLayoutView.swift */; };
3073016D2B3DB70000C5F5B4 /* StreamDeckKit_ExampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3073016C2B3DB70000C5F5B4 /* StreamDeckKit_ExampleApp.swift */; };
3073016D2B3DB70000C5F5B4 /* StreamDeckKitExampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3073016C2B3DB70000C5F5B4 /* StreamDeckKitExampleApp.swift */; };
3073016F2B3DB70000C5F5B4 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3073016E2B3DB70000C5F5B4 /* ContentView.swift */; };
307301712B3DB70100C5F5B4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 307301702B3DB70100C5F5B4 /* Assets.xcassets */; };
307301742B3DB70100C5F5B4 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 307301732B3DB70100C5F5B4 /* Preview Assets.xcassets */; };
Expand All @@ -22,7 +22,7 @@
21DE1EAA2B46E86600B18417 /* Example-App-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = "Example-App-Info.plist"; sourceTree = SOURCE_ROOT; };
30303E222B6CDEF500DC3084 /* StreamDeckLayoutView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StreamDeckLayoutView.swift; sourceTree = "<group>"; };
307301692B3DB70000C5F5B4 /* StreamDeckKit Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "StreamDeckKit Example.app"; sourceTree = BUILT_PRODUCTS_DIR; };
3073016C2B3DB70000C5F5B4 /* StreamDeckKit_ExampleApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StreamDeckKit_ExampleApp.swift; sourceTree = "<group>"; };
3073016C2B3DB70000C5F5B4 /* StreamDeckKitExampleApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StreamDeckKitExampleApp.swift; sourceTree = "<group>"; };
3073016E2B3DB70000C5F5B4 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
307301702B3DB70100C5F5B4 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
307301732B3DB70100C5F5B4 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -67,7 +67,7 @@
children = (
21DE1EAA2B46E86600B18417 /* Example-App-Info.plist */,
307301852B3DBC7600C5F5B4 /* Example App.entitlements */,
3073016C2B3DB70000C5F5B4 /* StreamDeckKit_ExampleApp.swift */,
3073016C2B3DB70000C5F5B4 /* StreamDeckKitExampleApp.swift */,
3073016E2B3DB70000C5F5B4 /* ContentView.swift */,
30303E222B6CDEF500DC3084 /* StreamDeckLayoutView.swift */,
307301702B3DB70100C5F5B4 /* Assets.xcassets */,
Expand Down Expand Up @@ -99,6 +99,7 @@
isa = PBXNativeTarget;
buildConfigurationList = 307301772B3DB70100C5F5B4 /* Build configuration list for PBXNativeTarget "Example App" */;
buildPhases = (
30DED3452B8390000042BCA8 /* SwiftLint */,
307301652B3DB70000C5F5B4 /* Sources */,
307301662B3DB70000C5F5B4 /* Frameworks */,
307301672B3DB70000C5F5B4 /* Resources */,
Expand Down Expand Up @@ -166,13 +167,35 @@
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
30DED3452B8390000042BCA8 /* SwiftLint */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = SwiftLint;
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "export PATH=\"$PATH:/opt/homebrew/bin\"\nif which swiftlint > /dev/null; then\n swiftlint lint ../Sources\n swiftlint lint \"Example App\"\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\n exit 1\nfi\n";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
307301652B3DB70000C5F5B4 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
3073016F2B3DB70000C5F5B4 /* ContentView.swift in Sources */,
3073016D2B3DB70000C5F5B4 /* StreamDeckKit_ExampleApp.swift in Sources */,
3073016D2B3DB70000C5F5B4 /* StreamDeckKitExampleApp.swift in Sources */,
30303E232B6CDEF500DC3084 /* StreamDeckLayoutView.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -310,6 +333,7 @@
DEVELOPMENT_ASSET_PATHS = "\"Example App/Preview Content\"";
DEVELOPMENT_TEAM = Y93VXCB8Q5;
ENABLE_PREVIEWS = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "Example-App-Info.plist";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
Expand Down Expand Up @@ -341,6 +365,7 @@
DEVELOPMENT_ASSET_PATHS = "\"Example App/Preview Content\"";
DEVELOPMENT_TEAM = Y93VXCB8Q5;
ENABLE_PREVIEWS = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "Example-App-Info.plist";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ extension StreamDeck {
}
}

// swiftlint:disable:next cyclomatic_complexity function_body_length
private func run(_ operation: Operation) async {
switch operation {
case let .setInputEventHandler(handler):
Expand Down

0 comments on commit 6257190

Please sign in to comment.