Skip to content

Commit

Permalink
chore: add swiftlint GH action (#3455)
Browse files Browse the repository at this point in the history
* chore: add swiftlint GH action

* chore: add xcodeproj with swiftlint build phase

* chore: update git-blame-ignore-revs
  • Loading branch information
phantumcode authored Jan 4, 2024
1 parent 659e861 commit 3b2ceba
Show file tree
Hide file tree
Showing 4 changed files with 437 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Resolve SwiftLint errors and warnings
# https://github.com/aws-amplify/amplify-swift/pull/3451
659e8615da059eea5b6a4ce1b77120eae293ebec
46 changes: 46 additions & 0 deletions .github/workflows/swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: SwiftLint
on:
workflow_dispatch:
workflow_call:
inputs:
identifier:
required: true
type: string

push:
branches-ignore:
- main
- v1
- release
- release-v1

permissions:
contents: read

concurrency:
group: ${{ inputs.identifier || github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.ref_name != 'main'}}

jobs:
run-swiftlint:
runs-on: ubuntu-latest
container:
image: ghcr.io/realm/swiftlint:0.54.0
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3
with:
persist-credentials: false

- name: SwiftLint
run: |
swiftlint --reporter github-actions-logging
confirm-pass:
runs-on: ubuntu-latest
name: Confirm Passing SwiftLint
if: ${{ !cancelled() }}
needs: [ run-swiftlint ]
env:
EXIT_CODE: ${{ contains(needs.*.result, 'failure') && 1 || 0 }}
steps:
- run: exit $EXIT_CODE
27 changes: 23 additions & 4 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
# Do not specify an `included` section at this top-level file. Specify the
# `--config` option pointing to this file, and the `--path` option to the files
# you wish to lint
included:
- Amplify
- AmplifyPlugins

excluded:
- Pods
- .build
- AmplifyAsyncTesting
- AmplifyFunctionalTests
- AmplifyTestApp
- AmplifyTestCommon
- AmplifyTests
- AmplifyPlugins/Core/AWSPluginsCoreTests
- AmplifyPlugins/Core/AWSPluginsTestCommon
- AmplifyPlugins/Notifications/Push/Tests
- AmplifyPlugins/*/Tests

analyzer_rules:
- unused_import
Expand All @@ -18,22 +30,29 @@ closing_brace: error
colon:
severity: error
comma: error
empty_count: warning
empty_count:
severity: warning
empty_enum_arguments: error
function_body_length:
warning: 100
warning: 150
error: 150
identifier_name:
excluded:
- id
- of
- or
line_length:
warning: 120
ignores_urls: true
ignores_function_declarations: true
ignores_comments: true
warning: 160
error: 160
opening_brace: error
opening_brace:
severity: error
return_arrow_whitespace: error
statement_position:
severity: error
todo: warning
trailing_semicolon: error
non_optional_string_data_conversion:
severity: error
Loading

0 comments on commit 3b2ceba

Please sign in to comment.