Skip to content

Pp 2343 enable swift lint across entire mono repo#1064

Open
ValentinaIancu-Gini wants to merge 10 commits into
PP-2342-Enable-SwiftLint-Across-Mono-Repo-and-Resolve-Existing-Violationsfrom
PP-2343-Enable-SwiftLint-Across-Entire-Mono-Repo
Open

Pp 2343 enable swift lint across entire mono repo#1064
ValentinaIancu-Gini wants to merge 10 commits into
PP-2342-Enable-SwiftLint-Across-Mono-Repo-and-Resolve-Existing-Violationsfrom
PP-2343-Enable-SwiftLint-Across-Entire-Mono-Repo

Conversation

@ValentinaIancu-Gini

@ValentinaIancu-Gini ValentinaIancu-Gini commented Feb 27, 2026

Copy link
Copy Markdown
Contributor

Pull Request Description

Enables SwiftLint usage across the mono-repo by introducing a shared root configuration and wiring SwiftLint into Xcode build phases for example projects.

Changes:

  • Added a repo-level .swiftlint.yml with included/excluded paths and rule configuration.
  • Added a reusable scripts/swiftlint.sh runner supporting default/strict/fix modes.
  • Added/updated SwiftLint shell script build phases in BankSDK and HealthSDK example Xcode projects to use the root config.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Enables SwiftLint usage across the mono-repo by introducing a shared root configuration and wiring SwiftLint into Xcode build phases for example projects.

Changes:

  • Added a repo-level .swiftlint.yml with included/excluded paths and rule configuration.
  • Added a reusable scripts/swiftlint.sh runner supporting default/strict/fix modes.
  • Added/updated SwiftLint shell script build phases in BankSDK and HealthSDK example Xcode projects to use the root config.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.

File Description
scripts/swiftlint.sh Adds a CLI entrypoint to run SwiftLint consistently from the repo root.
HealthSDK/GiniHealthSDKExample/GiniHealthSDKExample.xcodeproj/project.pbxproj Adds a SwiftLint build phase pointing to the root .swiftlint.yml.
BankSDK/GiniBankSDKExample/GiniBankSDKExample.xcodeproj/project.pbxproj Adds SwiftLint build phases / updates existing one to use the root .swiftlint.yml; renames a build phase.
.swiftlint.yml Introduces the shared SwiftLint configuration and scope (included paths).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread BankSDK/GiniBankSDKExample/GiniBankSDKExample.xcodeproj/project.pbxproj Outdated
Comment thread scripts/swiftlint.sh
Comment on lines +17 to +22
# ── 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

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.
Comment on lines +459 to +466
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";

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.
Comment on lines +1742 to +1745
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";
};

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.
Comment thread .swiftlint.yml
Comment thread .swiftlint.yml Outdated
Comment thread .swiftlint.yml Outdated
Comment thread BankSDK/GiniBankSDKExample/GiniBankSDKExample.xcodeproj/project.pbxproj Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .swiftlint.yml Outdated
Comment thread .swiftlint.yml
Comment thread scripts/swiftlint.sh
Comment on lines +18 to +25
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
echo "❌ SwiftLint not found."
echo " Install via Homebrew: brew install swiftlint"
echo " Install via Mint: mint install realm/SwiftLint"

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.
Comment on lines +1728 to +1733
289235732F48F3090052152A /* SwiftLint */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (

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.

@qnaveed87 qnaveed87 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me

Thank yo foe the good work @ValentinaIancu-Gini

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants