Conversation
WalkthroughThe pre-commit hook configuration in Changes
Sequence Diagram(s)sequenceDiagram
participant Developer
participant Lefthook
participant Mint
participant SwiftFormat
participant SwiftLint
Developer->>Lefthook: Trigger pre-commit
Lefthook->>Mint: Run swiftformat on staged files
Mint->>SwiftFormat: Format code
SwiftFormat-->>Mint: Return formatted files
Lefthook->>SwiftLint: Run swiftlint with --fix on staged files
SwiftLint-->>Lefthook: Return linted files
Lefthook->>SwiftLint: Run swiftlint in strict mode on staged files
SwiftLint-->>Lefthook: Return lint results
Lefthook-->>Developer: Complete pre-commit checks
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
lefthook.yml(1 hunks)
🔇 Additional comments (1)
lefthook.yml (1)
2-2: Re-check the decision to disable parallel executionSetting
parallel: falseguarantees deterministic ordering (useful becauseswiftformatmutates files), but it also removes any chance of running the two subsequentswiftlintsteps concurrently.
If the mutations are fully finished and staged after the first job, the two linting passes could still safely run in parallel and cut the hook time roughly in half.Consider:
- parallel: false + parallel: true # keep deterministic order via explicit `run` dependencies (see docs)or using a dedicated
pre-commit-sequentialhook for the first step and keeping the default hook parallelised.
| parallel: false | ||
| jobs: | ||
| - run: bundle exec fastlane run_swift_format | ||
| - run: mint run swiftformat --config .swiftformat --exclude '**/Generated', 'Sources/StreamChatUI/StreamNuke', 'Sources/StreamChatUI/StreamSwiftyGif', 'Sources/StreamChatUI/StreamDifferenceKit' {staged_files} |
There was a problem hiding this comment.
--exclude argument will be parsed incorrectly – commas end up inside the individual tokens
The current quoting causes the shell to pass four distinct arguments:
'**/Generated,' 'Sources/StreamChatUI/StreamNuke,' 'Sources/StreamChatUI/StreamSwiftyGif,' 'Sources/StreamChatUI/StreamDifferenceKit'
swiftformat expects a single comma-separated string (--exclude a,b,c) or multiple --exclude flags.
As written, none of the paths (except the last) will match and formatting is applied to generated code.
- - run: mint run swiftformat --config .swiftformat --exclude '**/Generated', 'Sources/StreamChatUI/StreamNuke', 'Sources/StreamChatUI/StreamSwiftyGif', 'Sources/StreamChatUI/StreamDifferenceKit' {staged_files}
+ - run: >
+ mint run swiftformat \
+ --config .swiftformat \
+ --exclude '**/Generated, Sources/StreamChatUI/StreamNuke, Sources/StreamChatUI/StreamSwiftyGif, Sources/StreamChatUI/StreamDifferenceKit' \
+ {staged_files}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - run: mint run swiftformat --config .swiftformat --exclude '**/Generated', 'Sources/StreamChatUI/StreamNuke', 'Sources/StreamChatUI/StreamSwiftyGif', 'Sources/StreamChatUI/StreamDifferenceKit' {staged_files} | |
| - run: > | |
| mint run swiftformat \ | |
| --config .swiftformat \ | |
| --exclude '**/Generated, Sources/StreamChatUI/StreamNuke, Sources/StreamChatUI/StreamSwiftyGif, Sources/StreamChatUI/StreamDifferenceKit' \ | |
| {staged_files} |
🤖 Prompt for AI Agents
In lefthook.yml at line 4, the --exclude argument is incorrectly quoted, causing
the shell to split it into multiple arguments with trailing commas. Fix this by
either providing a single quoted string with all paths comma-separated and no
spaces, or by using multiple --exclude flags for each path. This ensures
swiftformat correctly receives the exclude patterns as intended.
Summary by CodeRabbit