Skip to content

Commit

Permalink
Adding swiftLint as a build step in CI (#486)
Browse files Browse the repository at this point in the history
  • Loading branch information
kubalani authored Mar 30, 2021
1 parent 5f53813 commit d548e09
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: CI

on:
on:
push:
branches:
- main
Expand All @@ -13,6 +13,18 @@ on:
- vnext-prototype

jobs:
validation:
runs-on: macos-10.15
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v2
- name: Switch to current version of Xcode
run: scripts/xcode_select_current_version.sh
- name: pod lib lint
run: scripts/podliblint.sh
- name: validation
run: scripts/validation.sh
xcodebuild:
runs-on: macos-10.15
strategy:
Expand All @@ -35,9 +47,5 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Switch to current version of Xcode
run: scripts/xcode_select_current_version.sh
- name: scripts/xcodebuild_wrapper.sh ${{ matrix.build_command }}
run: scripts/xcodebuild_wrapper.sh ${{ matrix.build_command }}
- name: pod lib lint
run: scripts/podliblint.sh
8 changes: 7 additions & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ whitelist_rules:
- redundant_string_enum_value

# Properties, variables, and constants should not have redundant type annotation
- redundant_type_annotation
# This rule is currently disabled because it invokes false warnings for Bool
# Github issue tracked on swift lint https://github.com/realm/SwiftLint/issues/3578
# - redundant_type_annotation

# Returning Void in a function declaration is redundant.
- redundant_void_return
Expand Down Expand Up @@ -166,9 +168,13 @@ whitelist_rules:

included: # paths to include during linting. `--path` is ignored if present.
- ${LINTPATH}
- ios
- macos

excluded: # paths to ignore during linting. Takes precedence over `included`.
- Pods
- tools

explicit_type_interface: # requires type annotation on everything but local variables and constants
excluded:
- local
Expand Down
7 changes: 7 additions & 0 deletions scripts/validation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# A simple script to validate project settings.

if which swiftlint >/dev/null; then
swiftlint --config --strict .swiftlint.yml
else
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi

0 comments on commit d548e09

Please sign in to comment.