Skip to content
Open
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
137 changes: 137 additions & 0 deletions .swiftlint.yml
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

Comment thread
ValentinaIancu-Gini marked this conversation as resolved.
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
Comment thread
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
Expand Up @@ -1313,7 +1313,8 @@
28FB83B52E673C8600DE88EE /* Sources */,
28FB83B62E673C8600DE88EE /* Frameworks */,
28FB83B72E673C8600DE88EE /* Resources */,
280427BF2E705FA1000D658A /* ShellScript */,
280427BF2E705FA1000D658A /* Crashlytics */,
289235732F48F3090052152A /* SwiftLint */,
);
buildRules = (
);
Expand Down Expand Up @@ -1400,6 +1401,7 @@
F4807C30263C20BA00F30FF3 /* Sources */,
F4807C31263C20BA00F30FF3 /* Frameworks */,
F4807C32263C20BA00F30FF3 /* Resources */,
28A53CAE2F51D5410004D557 /* SwiftLint */,
);
buildRules = (
);
Expand Down Expand Up @@ -1675,8 +1677,9 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
280427BF2E705FA1000D658A /* ShellScript */ = {
280427BF2E705FA1000D658A /* Crashlytics */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand All @@ -1690,6 +1693,7 @@
"$(TARGET_BUILD_DIR)/$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/GoogleService-Info.plist",
"$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)",
);
name = Crashlytics;
outputFileListPaths = (
);
outputPaths = (
Expand Down Expand Up @@ -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

Copilot AI Mar 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This SwiftLint build phase (ID 289235...) is missing alwaysOutOfDate = 1 while the other SwiftLint phases in this project have it. That inconsistency can lead to SwiftLint being skipped depending on Xcode’s dependency analysis settings. Consider making the setting consistent across targets (or explicitly configuring input/output paths if you want dependency-based execution).

Copilot uses AI. Check for mistakes.
);
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

Copilot AI Feb 27, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SwiftLint build phase script is duplicated inline even though scripts/swiftlint.sh exists at the repo root. Consider calling the shared script from this build phase to keep PATH/config/tool-resolution logic consistent across projects/targets.

Copilot uses AI. Check for mistakes.
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;
Expand All @@ -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 */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@
F4EC38BC273C21E4007045DC /* Frameworks */,
F4EC38BD273C21E4007045DC /* Resources */,
282DD2C12E4B2A8100A4EDCE /* Upload DSYM */,
28A53CAF2F51D5DC0004D557 /* SwiftLint */,
);
buildRules = (
);
Expand Down Expand Up @@ -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

Copilot AI Feb 27, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SwiftLint invocation logic is duplicated inline in multiple Xcode project build phases even though scripts/swiftlint.sh exists. Pointing the Xcode build phase(s) at the shared script would reduce drift (e.g. when updating PATH/config options) and make SwiftLint behavior consistent across the mono-repo.

Copilot uses AI. Check for mistakes.
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down
58 changes: 58 additions & 0 deletions scripts/swiftlint.sh
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

Copilot AI Feb 27, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script stores a multi-word command in SWIFTLINT (e.g. mint run ...) and later executes it via $SWIFTLINT ..., which relies on word-splitting and is fragile. Consider using a Bash array (e.g. SWIFTLINT=(mint run …)) or a small wrapper function, and prefer command -v over which for tool detection.

Copilot uses AI. Check for mistakes.
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

Copilot AI Mar 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Mint fallback command (mint run swiftlint swiftlint) doesn’t match the installation instructions just below (mint install realm/SwiftLint). As written, this may fail because mint run typically expects the repository name (e.g. realm/SwiftLint). Align the mint run invocation with the documented install source so the fallback works reliably.

Copilot uses AI. Check for mistakes.
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
Loading