Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding swiftLint as a build step in CI #486

Merged
merged 5 commits into from
Mar 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
kubalani marked this conversation as resolved.
Show resolved Hide resolved
swiftlint --config --strict .swiftlint.yml
else
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi