-
Notifications
You must be signed in to change notification settings - Fork 3
Pp 2343 enable swift lint across entire mono repo #1064
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
base: PP-2342-Enable-SwiftLint-Across-Mono-Repo-and-Resolve-Existing-Violations
Are you sure you want to change the base?
Changes from all commits
12022af
40da484
a91c204
681a0f2
d31b39a
afa6d75
4fe963e
9fc5ec6
8a0c772
e43f525
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,137 @@ | ||
|
|
||
| opt_in_rules: | ||
| - trailing_newline | ||
| - control_statement | ||
| # - empty_count | ||
| - trailing_closure | ||
| - switch_case_on_newline | ||
| - colon | ||
| - comma | ||
| - unused_import | ||
| - redundant_nil_coalescing | ||
| - redundant_type_annotation | ||
| - vertical_whitespace_closing_braces | ||
| - fatal_error_message | ||
| - explicit_init | ||
| - trailing_whitespace | ||
| - vertical_whitespace | ||
| - vertical_whitespace_between_cases | ||
| - closure_spacing | ||
| - operator_usage_whitespace | ||
|
|
||
| disabled_rules: | ||
| - class_delegate_protocol | ||
| - notification_center_detachment | ||
| - identifier_name | ||
| - empty_enum_arguments | ||
| - multiple_closures_with_trailing_closure | ||
| - todo | ||
| - type_name | ||
| - switch_case_alignment | ||
| - force_try # This is just temporary added here | ||
| - force_unwrapping # This is just temporary added here | ||
| - empty_count # This is just temporary added here | ||
| - force_cast # This is just temporary added here | ||
| - shorthand_operator # This is just temporary added here | ||
|
|
||
| trailing_whitespace: | ||
| ignores_empty_lines: true | ||
|
|
||
| type_body_length: | ||
| - 300 # warning # Temporarily disabled | ||
|
|
||
| cyclomatic_complexity: | ||
| warning: 10 | ||
| # error: 15 # Temporarily disabled | ||
| ignores_case_statements: true | ||
|
|
||
| line_length: | ||
| ignores_comments: true | ||
| ignores_urls: true | ||
| warning: 160 | ||
| # error: 200 # Temporarily disabled | ||
|
|
||
| file_length: | ||
| ignore_comment_only_lines: true | ||
| warning: 1000 | ||
| # error: 2000 # Temporarily disabled | ||
|
|
||
| large_tuple: | ||
| warning: 4 | ||
| # error: 5 # Temporarily disabled | ||
|
|
||
| nesting: | ||
| type_level: | ||
| warning: 2 | ||
|
|
||
| # force_try: error # Temporarily disabled | ||
| # force_unwrapping: error # Temporarily disabled | ||
| overrides: | ||
| - included: ".*Tests.*" | ||
| force_try: warning | ||
| force_unwrapping: warning | ||
|
ValentinaIancu-Gini marked this conversation as resolved.
|
||
|
|
||
| type_name: | ||
| max_length: 50 | ||
|
|
||
| identifier_name: | ||
| min_length: 2 | ||
| allowed_symbols: | ||
| - _ | ||
| excluded: | ||
| - id | ||
| - to | ||
| - or | ||
| - ok | ||
| - in | ||
| - no | ||
| - km | ||
| - at | ||
| - sv | ||
| - x | ||
| - y | ||
|
|
||
| # analyzer_rules: # Rules run by `swiftlint analyze` | ||
| # - explicit_self | ||
|
|
||
| excluded: | ||
| - "**/.build" | ||
| - "**/.swiftpm" | ||
| - "**/Pods" | ||
| - "**/build" | ||
|
|
||
| included: | ||
| # BankSDK | ||
| - BankSDK/GiniBankSDK/Sources | ||
| - BankSDK/GiniBankSDK/Tests | ||
| - BankSDK/GiniBankSDKExample | ||
|
|
||
| # CaptureSDK | ||
| - CaptureSDK/GiniCaptureSDK/Sources | ||
| - CaptureSDK/GiniCaptureSDK/Tests | ||
|
|
||
| # HealthSDK | ||
| - HealthSDK/GiniHealthSDK/Sources | ||
| - HealthSDK/GiniHealthSDK/Tests | ||
| - HealthSDK/GiniHealthSDKExample | ||
|
|
||
| # BankAPILibrary | ||
| - BankAPILibrary/GiniBankAPILibrary/Sources | ||
| - BankAPILibrary/GiniBankAPILibrary/Tests | ||
| - BankAPILibrary/GiniBankAPILibraryExample | ||
|
|
||
| # HealthAPILibrary | ||
| - HealthAPILibrary/GiniHealthAPILibrary/Sources | ||
| - HealthAPILibrary/GiniHealthAPILibrary/Tests | ||
| - HealthAPILibrary/GiniHealthAPILibraryExample | ||
|
|
||
| # MerchantSDK | ||
| - MerchantSDK/GiniMerchantSDK/Sources | ||
| - MerchantSDK/GiniMerchantSDK/Tests | ||
| - MerchantSDK/GiniMerchantSDKExample | ||
|
|
||
| # GiniComponents | ||
| - GiniComponents/GiniInternalPaymentSDK/Sources | ||
| - GiniComponents/GiniInternalPaymentSDK/Tests | ||
| - GiniComponents/GiniUtilites/Sources | ||
| - GiniComponents/GiniUtilites/Tests | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1313,7 +1313,8 @@ | |
| 28FB83B52E673C8600DE88EE /* Sources */, | ||
| 28FB83B62E673C8600DE88EE /* Frameworks */, | ||
| 28FB83B72E673C8600DE88EE /* Resources */, | ||
| 280427BF2E705FA1000D658A /* ShellScript */, | ||
| 280427BF2E705FA1000D658A /* Crashlytics */, | ||
| 289235732F48F3090052152A /* SwiftLint */, | ||
| ); | ||
| buildRules = ( | ||
| ); | ||
|
|
@@ -1400,6 +1401,7 @@ | |
| F4807C30263C20BA00F30FF3 /* Sources */, | ||
| F4807C31263C20BA00F30FF3 /* Frameworks */, | ||
| F4807C32263C20BA00F30FF3 /* Resources */, | ||
| 28A53CAE2F51D5410004D557 /* SwiftLint */, | ||
| ); | ||
| buildRules = ( | ||
| ); | ||
|
|
@@ -1675,8 +1677,9 @@ | |
| /* End PBXResourcesBuildPhase section */ | ||
|
|
||
| /* Begin PBXShellScriptBuildPhase section */ | ||
| 280427BF2E705FA1000D658A /* ShellScript */ = { | ||
| 280427BF2E705FA1000D658A /* Crashlytics */ = { | ||
| isa = PBXShellScriptBuildPhase; | ||
| alwaysOutOfDate = 1; | ||
| buildActionMask = 2147483647; | ||
| files = ( | ||
| ); | ||
|
|
@@ -1690,6 +1693,7 @@ | |
| "$(TARGET_BUILD_DIR)/$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/GoogleService-Info.plist", | ||
| "$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)", | ||
| ); | ||
| name = Crashlytics; | ||
| outputFileListPaths = ( | ||
| ); | ||
| outputPaths = ( | ||
|
|
@@ -1721,6 +1725,43 @@ | |
| shellPath = /bin/sh; | ||
| shellScript = "# Type a script or drag a script file from your workspace to insert its path.\n\"${BUILD_DIR%/Build/*}/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run\"\n\n"; | ||
| }; | ||
| 289235732F48F3090052152A /* SwiftLint */ = { | ||
| isa = PBXShellScriptBuildPhase; | ||
| buildActionMask = 2147483647; | ||
| files = ( | ||
| ); | ||
| inputFileListPaths = ( | ||
|
Comment on lines
+1728
to
+1733
|
||
| ); | ||
| inputPaths = ( | ||
| ); | ||
| name = SwiftLint; | ||
| outputFileListPaths = ( | ||
| ); | ||
| outputPaths = ( | ||
| ); | ||
| runOnlyForDeploymentPostprocessing = 0; | ||
| shellPath = /bin/sh; | ||
| shellScript = "if test -d \"/opt/homebrew/bin/\"; then\n PATH=\"/opt/homebrew/bin/:${PATH}\"\nfi\nif test -d \"$HOME/.mint/bin\"; then\n PATH=\"$HOME/.mint/bin:${PATH}\"\nfi\nexport PATH\nif which swiftlint >/dev/null; then\n swiftlint --config \"${SRCROOT}/../../.swiftlint.yml\"\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; | ||
| }; | ||
|
Comment on lines
+1742
to
+1745
|
||
| 28A53CAE2F51D5410004D557 /* SwiftLint */ = { | ||
| isa = PBXShellScriptBuildPhase; | ||
| alwaysOutOfDate = 1; | ||
| buildActionMask = 2147483647; | ||
| files = ( | ||
| ); | ||
| inputFileListPaths = ( | ||
| ); | ||
| inputPaths = ( | ||
| ); | ||
| name = SwiftLint; | ||
| outputFileListPaths = ( | ||
| ); | ||
| outputPaths = ( | ||
| ); | ||
| runOnlyForDeploymentPostprocessing = 0; | ||
| shellPath = /bin/sh; | ||
| shellScript = "if test -d \"/opt/homebrew/bin/\"; then\n PATH=\"/opt/homebrew/bin/:${PATH}\"\nfi\nif test -d \"$HOME/.mint/bin\"; then\n PATH=\"$HOME/.mint/bin:${PATH}\"\nfi\nexport PATH\nif which swiftlint >/dev/null; then\n swiftlint --config \"${SRCROOT}/../../.swiftlint.yml\"\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; | ||
| }; | ||
| 8356CC2028D3652E0079AF00 /* SwiftLint */ = { | ||
| isa = PBXShellScriptBuildPhase; | ||
| alwaysOutOfDate = 1; | ||
|
|
@@ -1738,7 +1779,7 @@ | |
| ); | ||
| runOnlyForDeploymentPostprocessing = 0; | ||
| shellPath = /bin/sh; | ||
| shellScript = "if test -d \"/opt/homebrew/bin/\"; then\n PATH=\"/opt/homebrew/bin/:${PATH}\"\nfi\n\nif test -d \"$HOME/.mint/bin\"; then\n PATH=\"$HOME/.mint/bin:${PATH}\"\nfi\n\nexport PATH\n\nif which swiftlint >/dev/null; then\n swiftlint\nelse\necho \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; | ||
| shellScript = "if test -d \"/opt/homebrew/bin/\"; then\n PATH=\"/opt/homebrew/bin/:${PATH}\"\nfi\nif test -d \"$HOME/.mint/bin\"; then\n PATH=\"$HOME/.mint/bin:${PATH}\"\nfi\nexport PATH\nif which swiftlint >/dev/null; then\n swiftlint --config \"${SRCROOT}/../../.swiftlint.yml\"\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; | ||
| }; | ||
| /* End PBXShellScriptBuildPhase section */ | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -311,6 +311,7 @@ | |
| F4EC38BC273C21E4007045DC /* Frameworks */, | ||
| F4EC38BD273C21E4007045DC /* Resources */, | ||
| 282DD2C12E4B2A8100A4EDCE /* Upload DSYM */, | ||
| 28A53CAF2F51D5DC0004D557 /* SwiftLint */, | ||
| ); | ||
| buildRules = ( | ||
| ); | ||
|
|
@@ -445,6 +446,25 @@ | |
| shellPath = /bin/sh; | ||
| shellScript = "# Type a script or drag a script file from your workspace to insert its path.\n\"${BUILD_DIR%/Build/*}/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run\"\n"; | ||
| }; | ||
| 28A53CAF2F51D5DC0004D557 /* SwiftLint */ = { | ||
| isa = PBXShellScriptBuildPhase; | ||
| alwaysOutOfDate = 1; | ||
| buildActionMask = 2147483647; | ||
| files = ( | ||
| ); | ||
| inputFileListPaths = ( | ||
| ); | ||
| inputPaths = ( | ||
| ); | ||
| name = SwiftLint; | ||
| outputFileListPaths = ( | ||
| ); | ||
| outputPaths = ( | ||
| ); | ||
| runOnlyForDeploymentPostprocessing = 0; | ||
| shellPath = /bin/sh; | ||
| shellScript = "if test -d \"/opt/homebrew/bin/\"; then\n PATH=\"/opt/homebrew/bin/:${PATH}\"\nfi\nif test -d \"$HOME/.mint/bin\"; then\n PATH=\"$HOME/.mint/bin:${PATH}\"\nfi\nexport PATH\nif which swiftlint >/dev/null; then\n swiftlint --config \"${SRCROOT}/../../.swiftlint.yml\"\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; | ||
|
Comment on lines
+459
to
+466
|
||
| }; | ||
| /* End PBXShellScriptBuildPhase section */ | ||
|
|
||
| /* Begin PBXSourcesBuildPhase section */ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| #!/bin/bash | ||
| # SwiftLint runner for gini-mobile-ios | ||
| # | ||
| # Usage: | ||
| # ./scripts/swiftlint.sh — lint with warnings only | ||
| # ./scripts/swiftlint.sh --strict — fail on warnings (use in CI) | ||
| # ./scripts/swiftlint.sh --fix — auto-correct fixable violations | ||
| # | ||
| # The script resolves the project root regardless of where it is called from. | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)" | ||
| CONFIG="${ROOT_DIR}/.swiftlint.yml" | ||
| MODE="${1:-}" | ||
|
|
||
| # ── Locate SwiftLint ────────────────────────────────────────────────────────── | ||
| if which swiftlint > /dev/null 2>&1; then | ||
| SWIFTLINT="swiftlint" | ||
| elif which mint > /dev/null 2>&1 && mint which swiftlint > /dev/null 2>&1; then | ||
| SWIFTLINT="mint run swiftlint swiftlint" | ||
| else | ||
|
Comment on lines
+17
to
+22
|
||
| echo "❌ SwiftLint not found." | ||
| echo " Install via Homebrew: brew install swiftlint" | ||
| echo " Install via Mint: mint install realm/SwiftLint" | ||
|
Comment on lines
+18
to
+25
|
||
| exit 1 | ||
| fi | ||
|
|
||
| # ── Run ─────────────────────────────────────────────────────────────────────── | ||
| echo "🔍 SwiftLint — project root: ${ROOT_DIR}" | ||
| echo " Config: ${CONFIG}" | ||
| echo " Mode: ${MODE:-default (warnings)}" | ||
| echo "" | ||
|
|
||
| cd "$ROOT_DIR" | ||
|
|
||
| case "$MODE" in | ||
| --fix) | ||
| $SWIFTLINT --fix --config "$CONFIG" | ||
| echo "" | ||
| echo "✅ Auto-correct complete." | ||
| ;; | ||
| --strict) | ||
| $SWIFTLINT lint --strict --config "$CONFIG" | ||
| echo "" | ||
| echo "✅ Lint passed (strict mode)." | ||
| ;; | ||
| "") | ||
| $SWIFTLINT lint --config "$CONFIG" | ||
| echo "" | ||
| echo "✅ Lint complete." | ||
| ;; | ||
| *) | ||
| echo "❌ Unknown option: $MODE" | ||
| echo " Usage: $0 [--strict | --fix]" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
Uh oh!
There was an error while loading. Please reload this page.