Skip to content

Add auto-correction, indentation config, and multi-violation support to multiline_call_arguments#6745

Draft
GandaLF2006 wants to merge 4 commits into
realm:mainfrom
GandaLF2006:gandalf2006/multiline_call_arguments/correctable
Draft

Add auto-correction, indentation config, and multi-violation support to multiline_call_arguments#6745
GandaLF2006 wants to merge 4 commits into
realm:mainfrom
GandaLF2006:gandalf2006/multiline_call_arguments/correctable

Conversation

@GandaLF2006

Copy link
Copy Markdown
Contributor

Summary

Enhances the multiline_call_arguments opt-in rule with auto-correction, a new indentation configuration option, and multi-violation detection in a single pass.

Auto-correction (--fix)

  • Single-line calls are reformatted to place each argument on its own line with proper indentation; the closing ) moves to its own line at the call's base indent
  • Multi-line calls with duplicate-start-line or missing-newline-after-comma violations are corrected by inserting \n + indent in the appropriate range
  • Calls with comments in argument tokens are not auto-corrected (manual fix required); string literals containing comment-like text are correctly identified as non-comments
  • Nested single-line calls that would produce overlapping corrections: only the outer call's correction is applied; the inner call is corrected on a subsequent --fix pass

indentation configuration

  • New option: indentation (integer ≥ 1 for spaces, or the string "tab"; default: 4)
  • 0 and negative values are invalid and cause a configuration error
  • Indentation is calculated relative to the call's start line — one level of configured indentation from the call's base indent

Multi-violation support

  • Previously, duplicateArgumentStartLineViolation and newlineAfterCommaViolation returned at the first match, requiring repeated --fix passes for calls with multiple same-line argument pairs
  • Now collects all violations in a single pass (reasonedViolations returns [ReasonedRuleViolation])

Documentation

  • Split RuleDescription.description into concise description (what) + structured rationale (why/how) with markdown sections

@GandaLF2006 GandaLF2006 force-pushed the gandalf2006/multiline_call_arguments/correctable branch 2 times, most recently from b183a6a to 78a2da1 Compare June 1, 2026 09:19
@GandaLF2006

GandaLF2006 commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

@SimplyDanny Let's add correctable for multiline_call_arguments :)

The CI failure on oss_scan is not related to this PR — it's a danger bot failing to post a comment due to the repository's interaction limits (422 - Interactions on this repository have been restricted to prior contributors only)

@GandaLF2006 GandaLF2006 force-pushed the gandalf2006/multiline_call_arguments/correctable branch from f16bd4c to 8b5b043 Compare June 6, 2026 18:56
@SwiftLintBot

SwiftLintBot commented Jun 6, 2026

Copy link
Copy Markdown
4191 Warnings
⚠️ Big PR
⚠️ This PR introduced a violation in Aerial: /Aerial/Source/Views/Layers/ClockLayer.swift:80:27: Warning: In multi-line calls, a newline is required after each comma (multiline_call_arguments)
⚠️ This PR introduced a violation in Aerial: /Aerial/Source/Views/Layers/Weather/ForecastLayer.swift:65:53: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in Aerial: /Aerial/Source/Views/Layers/Weather/ForecastLayer.swift:66:87: Warning: In multi-line calls, a newline is required after each comma (multiline_call_arguments)
⚠️ This PR introduced a violation in Aerial: /Aerial/Source/Views/Layers/Weather/ForecastLayer.swift:93:53: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in Aerial: /Aerial/Source/Views/Layers/Weather/ForecastLayer.swift:94:70: Warning: In multi-line calls, a newline is required after each comma (multiline_call_arguments)
⚠️ This PR introduced a violation in Aerial: /Aerial/Source/Views/AerialView.swift:639:58: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Sources/PrivacyStats/internal/PrivacyStatsUtils.swift:44:91: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Sources/BrowserServicesKit/SecureVault/AutofillDatabaseProvider.swift:568:22: Warning: In multi-line calls, a newline is required after each comma (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Sources/BrowserServicesKit/SecureVault/AutofillDatabaseProvider.swift:629:22: Warning: In multi-line calls, a newline is required after each comma (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Sources/BrowserServicesKit/SecureVault/AutofillDatabaseProvider.swift:760:22: Warning: In multi-line calls, a newline is required after each comma (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Sources/BrowserServicesKit/SecureVault/AutofillDatabaseProvider.swift:1392:18: Warning: In multi-line calls, a newline is required after each comma (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Sources/SyncDataProviders/Bookmarks/internal/BookmarkEntity+Syncable.swift:49:43: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Sources/RemoteMessaging/RemoteMessagingStore.swift:388:65: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Sources/Bookmarks/FaviconsFetcher/FaviconsFetchOperation.swift:242:46: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Sources/PixelKit/PixelFiring.swift:72:43: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Sources/PixelKit/PixelFiring.swift:72:61: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Sources/PixelKit/PixelFiring.swift:73:42: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Sources/PixelKit/PixelFiring.swift:73:98: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/Core/TabInstrumentation.swift:56:72: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/Core/Instruments.swift:50:63: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/Core/UIViewExtension.swift:32:52: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/Core/UIViewExtension.swift:33:33: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/Core/UIViewExtension.swift:33:48: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/Core/UIViewExtension.swift:39:51: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/Core/UIViewExtension.swift:40:32: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/Core/UIViewExtension.swift:40:47: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/AppLifecycle/AppStates/Launching.swift:499:85: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/UnifiedToggleInput/UnifiedToggleInputCoordinator.swift:77:62: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/UnifiedToggleInput/UnifiedToggleInputCoordinator.swift:77:80: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/UnifiedToggleInput/MainViewController+UnifiedToggleInput.swift:1380:53: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/UnifiedToggleInput/MainViewController+UnifiedToggleInput.swift:1380:79: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/AlertPlaygroundView.swift:119:69: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/UIHostingControllerExtension.swift:48:120: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/TabSwitcherViewController+MultiSelect.swift:273:66: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/TabSwitcherViewController+MultiSelect.swift:276:68: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/PrivacyIconView.swift:222:74: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/PrivacyIconView.swift:222:109: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/PrivacyIconView.swift:235:74: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/PrivacyIconView.swift:235:109: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/TabSwitcherViewController+KeyCommands.swift:26:77: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/TabSwitcherViewController+KeyCommands.swift:27:45: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/TabSwitcherViewController+KeyCommands.swift:29:77: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/TabSwitcherViewController+KeyCommands.swift:30:53: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/TabSwitcherViewController+KeyCommands.swift:34:72: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/TabSwitcherViewController+KeyCommands.swift:35:55: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/TabSwitcherViewController+KeyCommands.swift:36:72: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/TabSwitcherViewController+KeyCommands.swift:37:55: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/TabSwitcherViewController+KeyCommands.swift:43:80: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/TabSwitcherViewController+KeyCommands.swift:44:65: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/TabSwitcherViewController+KeyCommands.swift:49:79: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/TabSwitcherViewController+KeyCommands.swift:50:45: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/TabSwitcherViewController+KeyCommands.swift:52:81: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/TabSwitcherViewController+KeyCommands.swift:53:45: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/TabSwitcherViewController+KeyCommands.swift:54:83: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/TabSwitcherViewController+KeyCommands.swift:55:45: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/TabSwitcherViewController+KeyCommands.swift:57:81: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/TabSwitcherViewController+KeyCommands.swift:58:45: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/TabSwitcherViewController+KeyCommands.swift:59:83: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/TabSwitcherViewController+KeyCommands.swift:60:45: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/TabSwitcherViewController+KeyCommands.swift:62:75: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/TabSwitcherViewController+KeyCommands.swift:63:45: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/DebugScreensViewController.swift:158:51: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/DebugScreensViewController.swift:174:88: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/BookmarksDebugViewController.swift:44:140: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/TabViewController.swift:1058:40: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/TabViewController.swift:3332:85: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/TabViewController.swift:3366:89: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/TabViewController.swift:4435:77: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/Subscription/Views/SubscriptionAIChatView.swift:45:48: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/SwipeTabsCoordinator.swift:794:57: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/SwipeTabsCoordinator.swift:794:81: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController.swift:1077:96: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController.swift:1079:95: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController.swift:1081:95: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController.swift:3939:43: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/AIChat/AIChatViewControllerManager.swift:131:39: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/AIChat/AIChatViewControllerManager.swift:131:59: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/AIChat/AIChatViewControllerManager.swift:131:79: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/AIChat/AIChatViewControllerManager.swift:132:32: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/AIChat/AIChatViewControllerManager.swift:132:66: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/AIChat/AIChatViewControllerManager.swift:132:82: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/AIChat/AIChatViewControllerManager.swift:133:40: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/AIChat/AIChatViewControllerManager.swift:160:39: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/AIChat/AIChatViewControllerManager.swift:160:59: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/AIChat/AIChatViewControllerManager.swift:160:79: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/AIChat/AIChatViewControllerManager.swift:161:32: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/AIChat/AIChatViewControllerManager.swift:161:66: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/AIChat/AIChatViewControllerManager.swift:161:82: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/AIChat/AIChatViewControllerManager.swift:162:44: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/AIChat/AIChatViewControllerManager.swift:163:52: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/AIChat/InputBox/SwitchBar/TextEntry/SwitchBarTextEntryView.swift:986:58: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/AIChat/InputBox/SwitchBar/TextEntry/SwitchBarTextEntryView.swift:986:82: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/IntervalSlider.swift:53:63: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:27:70: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:28:67: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:38:74: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:38:86: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:40:84: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:40:96: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:42:81: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:42:93: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:44:84: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:44:121: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:46:81: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:46:117: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:48:76: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:48:88: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:50:75: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:50:87: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:52:81: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:52:93: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:54:81: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:54:93: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:56:81: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:56:100: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:58:81: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:58:100: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:60:76: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:60:88: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:62:76: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:62:88: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:64:77: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:64:89: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:66:79: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:66:91: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:74:78: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:74:90: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:76:82: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:76:94: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:90:74: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ This PR introduced a violation in DuckDuckGo: /iOS/DuckDuckGo/MainViewController+KeyCommands.swift:90:86: Warning: In multi-line calls, each argument must start on its own line (multiline_call_arguments)
⚠️ Danger found 4191 violations with this PR. Due to GitHub's max issue comment size, the number shown has been truncated to 132.
19 Messages
📖 Building this branch resulted in a binary size of 28238.24 KiB vs 28200.24 KiB when built on main (0% larger).
📖 Linting Aerial with this PR took 0.65 s vs 0.66 s on main (1% faster).
📖 Linting Alamofire with this PR took 0.9 s vs 0.93 s on main (3% faster).
📖 Linting Brave with this PR took 5.94 s vs 5.99 s on main (0% faster).
📖 Linting DuckDuckGo with this PR took 25.51 s vs 25.52 s on main (0% faster).
📖 Linting Firefox with this PR took 10.38 s vs 10.39 s on main (0% faster).
📖 Linting Kickstarter with this PR took 7.47 s vs 7.35 s on main (1% slower).
📖 Linting Moya with this PR took 0.39 s vs 0.35 s on main (11% slower).
📖 Linting NetNewsWire with this PR took 2.36 s vs 2.38 s on main (0% faster).
📖 Linting Nimble with this PR took 0.58 s vs 0.59 s on main (1% faster).
📖 Linting PocketCasts with this PR took 6.89 s vs 6.92 s on main (0% faster).
📖 Linting Quick with this PR took 0.35 s vs 0.33 s on main (6% slower).
📖 Linting Realm with this PR took 2.51 s vs 2.47 s on main (1% slower).
📖 Linting Sourcery with this PR took 1.5 s vs 1.49 s on main (0% slower).
📖 Linting Swift with this PR took 4.23 s vs 4.27 s on main (0% faster).
📖 Linting SwiftLintPerformanceTests with this PR took 0.17 s vs 0.16 s on main (6% slower).
📖 Linting VLC with this PR took 1.07 s vs 1.09 s on main (1% faster).
📖 Linting Wire with this PR took 15.17 s vs 15.27 s on main (0% faster).
📖 Linting WordPress with this PR took 9.77 s vs 9.85 s on main (0% faster).

Generated by 🚫 Danger

@GandaLF2006 GandaLF2006 force-pushed the gandalf2006/multiline_call_arguments/correctable branch from 3c09c9b to c2b5aa8 Compare June 6, 2026 22:32
@GandaLF2006 GandaLF2006 requested a review from SimplyDanny June 7, 2026 15:38
@GandaLF2006 GandaLF2006 force-pushed the gandalf2006/multiline_call_arguments/correctable branch 2 times, most recently from 9510ef7 to 0cdc2a7 Compare June 15, 2026 07:10
@GandaLF2006 GandaLF2006 force-pushed the gandalf2006/multiline_call_arguments/correctable branch 4 times, most recently from 7b65161 to 9a91acd Compare June 24, 2026 11:28
@GandaLF2006

Copy link
Copy Markdown
Contributor Author

@SimplyDanny It would be great if you could review the PR :)

@GandaLF2006 GandaLF2006 force-pushed the gandalf2006/multiline_call_arguments/correctable branch from 9a91acd to 0bd454f Compare June 24, 2026 11:54

@SimplyDanny SimplyDanny left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I have some findings. Please consider them and rebase your branch updating your tests to Swift Testing.

Pleas also check why there are so many OSS findings.

/// Indentation style for corrected lines.
/// Can be an integer (number of spaces) or the string "tabs".
@ConfigurationElement(key: "indentation")
private(set) var indentationStyle: IndentationStyle = .spaces(count: 4)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can the global option not be reused?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I looked into this, and unfortunately the global indentation is not currently accessible from rules. Here's what I found:

  • Linter stores the full Configuration (including indentation), but when invoking rules it only passes SwiftLintFile + per-rule config to validate(file:using:compilerArguments:).
  • Neither SwiftLintFile, ViolationsSyntaxVisitor, nor RuleStorage hold a reference to the global Configuration.
  • The global configuration.indentation is consumed only by --format in LintOrAnalyzeCommand.swift — a separate code path that reformats file text directly without invoking any rules.

Is there an existing mechanism for rules to access the global Configuration.indentation that I'm overlooking? If so, could you point me in the right direction?

If not, reusing it would require threading the global indentation through the rule execution path — e.g. by adding it to SwiftLintFile or ViolationsSyntaxVisitor. This is a framework-wide change that affects all rules. I'd suggest doing this as a separate PR (ideally before merging this one) — once the global indentation is available to rules, the per-rule option can be removed in favor of it. For now, the rule reuses the shared IndentationStyle type from SwiftLintCore (the same type the global config uses), so it's ready to switch over when the plumbing is in place

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I looked into this further and found a way to make it work without a separate PR.

The global indentation was indeed not accessible from rules — Linter stores the full Configuration, but validate(file:using:compilerArguments:) only receives SwiftLintFile + per-rule config. However, SwiftLint already has CurrentRule with @TaskLocal properties for exactly this kind of cross-cutting concern (used for identifier and allowSourceKitRequestWithoutRule).

I added @TaskLocal public static var indentation: IndentationStyle? to CurrentRule and set it at the three rule-execution chokepoints in Linter.swift (lint, collect, correct) from Configuration.indentation. The rule reads it via CurrentRule.indentation, falling back to IndentationStyle.default when not set (e.g., in unit tests outside a Linter context).

The per-rule indentation option has been removed — the rule now uses the global indentation setting from .swiftlint.yml. End-to-end tests confirm the full pipeline: Configuration(indentation: .tabs)Lintercorrect → tab-indented output.

Comment thread Source/SwiftLintFramework/Configuration/Configuration+IndentationStyle.swift Outdated
Comment thread Source/SwiftLintBuiltInRules/Rules/Lint/MultilineCallArgumentsRule.swift Outdated
Comment thread Source/SwiftLintBuiltInRules/Rules/Lint/MultilineCallArgumentsRule.swift Outdated
Comment thread Source/SwiftLintBuiltInRules/Rules/Lint/MultilineCallArgumentsRuleExamples.swift Outdated
Comment thread Source/SwiftLintBuiltInRules/Rules/Lint/MultilineCallArgumentsRuleExamples.swift Outdated
Comment thread Tests/BuiltInRulesTests/MultilineCallArgumentsRuleTests.swift Outdated
Comment thread Tests/BuiltInRulesTests/MultilineCallArgumentsRuleTests.swift Outdated
Comment thread Tests/BuiltInRulesTests/MultilineCallArgumentsRuleTests.swift Outdated
@GandaLF2006 GandaLF2006 force-pushed the gandalf2006/multiline_call_arguments/correctable branch 3 times, most recently from ebc98ef to f694a41 Compare June 27, 2026 22:20
@GandaLF2006 GandaLF2006 requested a review from SimplyDanny June 27, 2026 22:43
Thread the global  into rules via a new
 on , set at the three rule-execution chokepoints
in  (lint, collect, correct). Remove the per-rule
 option from  in favor
of the global setting.
@GandaLF2006 GandaLF2006 force-pushed the gandalf2006/multiline_call_arguments/correctable branch from 8b03add to 1d6eaeb Compare June 28, 2026 19:47

@SimplyDanny SimplyDanny left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

A few more comments ...

In general, I'm not against using AI to help with coding. However, I expect from contributors that they understand what they are proposing, review the code and clean things up themselves.

I see a lot of redundancy and useless information in comments as well as unused code that I shouldn't not need to take care of as a reviewer. There are many other PRs waiting for my feedback. So please make sure to propose only changes that you have thoroughly reviewed and improved yourself. Otherwise, I might lose my motivation to review anything like this. AI only has a chance to be of help if it makes use faster as a whole. Shifting work from you to someone else doesn't increase throughput at all.

Comment thread CHANGELOG.md
`.swiftlint.yml`. The per-rule `indentation` option has been removed in
favor of the global one. The rule detects all violations in a single
pass (previously required repeated `--fix`); safely handles nested
calls by suppressing overlapping inner corrections.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Only mention what's really important for users to know. Progression of a PR review is not ...

}

@Suite
struct IndentationStyleTests {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should be in this file.

import Testing

@Suite(.rulesRegistered)
struct MultilineCallArgumentsRuleTests {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

There are still a lot of test cases in here that could just be part of the examples' list.

guard rule.shouldRun(onFile: file) else {
return nil
CurrentRule.$indentation.withValue(configuration.indentation) {
guard rule.shouldRun(onFile: file) else {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Does this need to be part of the withValue block already?

}

/// Conformance to ``AcceptableByConfigurationElement`` for use in rule configurations.
extension IndentationStyle: AcceptableByConfigurationElement {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Still needed?

Comment thread Source/SwiftLintCore/Models/CurrentRule.swift Outdated

/// The global indentation style from the top-level configuration, made available to rules
/// without modifying function signatures throughout the codebase.
@TaskLocal public static var indentation: IndentationStyle?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not sure about the usage of this yet. We should handle that separately anyway. It's not good to mix it into this PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I wasn't entirely sure about separating this change into a separate PR. Thanks for confirming my concerns.
I'll create a separate PR with global values, and after merging, we'll return to the current one.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@SimplyDanny
I'd be grateful if you could share your ideas about global configurations. Is there anything I should pay attention to? Should I try extracting all configurations or just the indentation?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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


/// Configuration for the `multiline_call_arguments` rule.
///
/// This configuration controls how function calls with multiple arguments should be formatted.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Useless comment.

Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
@GandaLF2006

Copy link
Copy Markdown
Contributor Author

A few more comments ...

In general, I'm not against using AI to help with coding. However, I expect from contributors that they understand what they are proposing, review the code and clean things up themselves.

I see a lot of redundancy and useless information in comments as well as unused code that I shouldn't not need to take care of as a reviewer. There are many other PRs waiting for my feedback. So please make sure to propose only changes that you have thoroughly reviewed and improved yourself. Otherwise, I might lose my motivation to review anything like this. AI only has a chance to be of help if it makes use faster as a whole. Shifting work from you to someone else doesn't increase throughput at all.

I completely agree with you about speeding up work with AI without shifting.
It was easier for me to write documentation for the code because I felt the context could be conveyed better. I'll review the documentation again, thanks for the tip.
Whenever I make a change, I check the code in a project with 2,000+ Swift files, using a sampling of 200+ examples.

@GandaLF2006 GandaLF2006 marked this pull request as draft July 1, 2026 07:54
@SimplyDanny

Copy link
Copy Markdown
Collaborator

A few more comments ...

In general, I'm not against using AI to help with coding. However, I expect from contributors that they understand what they are proposing, review the code and clean things up themselves.

I see a lot of redundancy and useless information in comments as well as unused code that I shouldn't not need to take care of as a reviewer. There are many other PRs waiting for my feedback. So please make sure to propose only changes that you have thoroughly reviewed and improved yourself. Otherwise, I might lose my motivation to review anything like this. AI only has a chance to be of help if it makes use faster as a whole. Shifting work from you to someone else doesn't increase throughput at all.

I completely agree with you about speeding up work with AI without shifting.

It was easier for me to write documentation for the code because I felt the context could be conveyed better. I'll review the documentation again, thanks for the tip.

Whenever I make a change, I check the code in a project with 2,000+ Swift files, using a sampling of 200+ examples.

I appreciate you running such extensive tests. The implementation and coverage look decent indeed. However, "it works" is not all I have an eye on. Project fit, simplicity and avoidance of redundancy are of similar importance. There is also nothing against letting AI document things. But sometimes no comment is just the right amount, especially in obvious cases. 😉

Thank you for relentlessly fixing all my (nitpicky) comments and the ongoing contributions!

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.

3 participants