summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBug Magnet <marco.nikic@mullvad.net>2023-08-09 12:40:59 +0200
committerBug Magnet <marco.nikic@mullvad.net>2023-08-11 14:26:46 +0200
commit86efb93c8e2463633f55644146f27a2c3fa3e009 (patch)
treed6f29043f38c21318463d22ecd4d5cd0fbbaefc0
parentdf209be76105db4da7b667f0b2eb4bfd24234ec4 (diff)
downloadmullvadvpn-86efb93c8e2463633f55644146f27a2c3fa3e009.tar.xz
mullvadvpn-86efb93c8e2463633f55644146f27a2c3fa3e009.zip
Add a swiftlint configuration and a github action for running swiftlint
Use the same swiftlint version as on brew
-rw-r--r--.github/workflows/ios.yml15
-rw-r--r--ios/.swiftlint.yml49
2 files changed, 64 insertions, 0 deletions
diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml
index aa82aa450b..44404a3f5f 100644
--- a/.github/workflows/ios.yml
+++ b/.github/workflows/ios.yml
@@ -26,6 +26,21 @@ jobs:
swiftformat --version
swiftformat --lint .
+ swiftlint:
+ name: Run swiftlint
+ runs-on: ubuntu-latest
+ container:
+ image: ghcr.io/realm/swiftlint:0.52.4
+
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 1
+
+ - name: SwiftLint
+ run: |
+ swiftlint --reporter github-actions-logging
+
test:
name: Unit tests
runs-on: macos-13
diff --git a/ios/.swiftlint.yml b/ios/.swiftlint.yml
new file mode 100644
index 0000000000..b5634621a3
--- /dev/null
+++ b/ios/.swiftlint.yml
@@ -0,0 +1,49 @@
+---
+disabled_rules:
+ - colon
+ - comma
+ - control_statement
+ - identifier_name
+ - type_body_length
+ - opening_brace # Differs from Google swift guidelines enforced by swiftformat
+ - trailing_comma
+opt_in_rules:
+ - empty_count
+
+analyzer_rules: # rules run by `swiftlint analyze`
+ - explicit_self
+
+included: # case-sensitive paths to include during linting. `--path` is ignored if present
+ - .
+excluded: # case-sensitive paths to ignore during linting. Takes precedence over `included`
+ - AdditionalAssets
+ - Assets
+ - Configurations
+ - MullvadVPNScreenshots
+
+allow_zero_lintable_files: false
+
+force_cast: warning
+force_try:
+ severity: warning
+line_length:
+ ignores_comments: true
+ ignores_interpolated_strings: true
+ warning: 120
+ error: 300
+
+type_name:
+ min_length: 4
+ max_length:
+ error: 50
+ excluded: iPhone # excluded via string
+ allowed_symbols: ["_"] # these are allowed in type names
+identifier_name:
+ allowed_symbols: ["_"] # these are allowed in type names
+ min_length:
+ error: 3
+ excluded:
+ - id
+ - URL
+ - GlobalAPIKey
+reporter: "xcode"