From 3541147e9fc5a41d73136e9f93d6fbeda61ba942 Mon Sep 17 00:00:00 2001 From: Rui Date: Mon, 6 Nov 2023 13:53:13 -0800 Subject: [PATCH] Clean up MarketInfo data and add SwiftLint action --- .github/workflows/SwiftLint.yml | 37 +++++++++++++ dydx/Pods/Abacus | 1 + .../dydxMarketConfigsViewPresenter.swift | 54 ++++++++++++------- .../dydxMarketPositionViewPresenter.swift | 2 +- .../Configs/dydxMarketConfigsView.swift | 12 +++-- .../Position/dydxMarketPositionView.swift | 6 +-- 6 files changed, 84 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/SwiftLint.yml create mode 160000 dydx/Pods/Abacus diff --git a/.github/workflows/SwiftLint.yml b/.github/workflows/SwiftLint.yml new file mode 100644 index 000000000..35fd11714 --- /dev/null +++ b/.github/workflows/SwiftLint.yml @@ -0,0 +1,37 @@ +name: SwiftLint on Changed Files + +on: [pull_request] + +jobs: + swiftlint: + name: Run SwiftLint + runs-on: macos-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 # fetch all history so that we can get the proper list of changed files + + - name: Install SwiftLint + run: brew install swiftlint + + - name: List all changed files + id: files + uses: jitterbit/get-changed-files@v1 + with: + format: space-delimited + + - name: Run SwiftLint on changed files + run: | + # Extract changed files and filter for Swift files + FILES="${{ steps.files.outputs.all }}" + SWIFT_FILES=$(echo "$FILES" | grep -E '\.(swift)$' | xargs) + # Run SwiftLint on each changed Swift file + # If no Swift files changed, skip the step + if [ -z "$SWIFT_FILES" ]; then + echo "No Swift files to lint." + else + echo "Linting changed Swift files..." + swiftlint lint -- $SWIFT_FILES + fi diff --git a/dydx/Pods/Abacus b/dydx/Pods/Abacus new file mode 160000 index 000000000..60873f31b --- /dev/null +++ b/dydx/Pods/Abacus @@ -0,0 +1 @@ +Subproject commit 60873f31bf17b641b10856bb4e038d570d690724 diff --git a/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/Components/dydxMarketConfigsViewPresenter.swift b/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/Components/dydxMarketConfigsViewPresenter.swift index 06f9c84af..183323afa 100644 --- a/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/Components/dydxMarketConfigsViewPresenter.swift +++ b/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/Components/dydxMarketConfigsViewPresenter.swift @@ -32,40 +32,54 @@ class dydxMarketConfigsViewPresenter: HostedViewPresenter