realm / SwiftLint

A tool to enforce Swift style and conventions.
https://realm.github.io/SwiftLint
MIT License
18.45k stars 2.2k forks source link

Add new opt-in `no_empty_block` rule #5617

Closed Ueeek closed 3 days ago

Ueeek commented 4 weeks ago

resolve #5615 Add no_empty_function rule

mildm8nnered commented 3 weeks ago

Should init and deinit be checked as well?

SwiftLintBot commented 1 week ago
1672 Warnings
:warning: This PR introduced a violation in Aerial: /Aerial/Source/Models/Hardware/ISSoundAdditions/SoundOutputManager+Properties.swift:34:15: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Aerial: /Aerial/Source/Models/Hardware/ISSoundAdditions/SoundOutputManager+Properties.swift:50:15: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Aerial: /Aerial/Source/Models/Hardware/ISSoundAdditions/SoundOutputManager.swift:35:21: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Aerial: /Aerial/Source/Views/AerialView+Player.swift:95:38: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Aerial: /Aerial/Source/Views/AerialView.swift:223:37: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Aerial: /Aerial/Source/Views/Layers/AnimationLayer.swift:24:34: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Aerial: /Aerial/Source/Views/Layers/AnimationLayer.swift:25:62: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Aerial: /Aerial/Source/Views/Layers/AnimationLayer.swift:26:42: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Aerial: /Aerial/Source/Views/Layers/AnimationTextLayer.swift:60:34: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Aerial: /Aerial/Source/Views/Layers/AnimationTextLayer.swift:61:62: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Aerial: /Aerial/Source/Views/Layers/AnimationTextLayer.swift:62:42: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Aerial: /Aerial/Source/Views/PrefPanel/InfoWeatherView.swift:136:21: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Aerial: /Aerial/Source/Views/PrefPanel/InfoWeatherView.swift:143:21: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Aerial: /Aerial/Source/Views/PrefPanel/InfoWeatherView.swift:44:38: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Aerial: /Resources/MainUI/First time setup/VideoFormatViewController.swift:30:37: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Aerial: /Resources/MainUI/Settings panels/BrightnessViewController.swift:90:84: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Core/DataStreamRequest.swift:546:19: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Core/DataStreamRequest.swift:554:19: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Core/HTTPHeaders.swift:32:19: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/AlamofireExtended.swift:53:13: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/AlamofireExtended.swift:59:13: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:231:92: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:234:78: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:239:61: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:240:96: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:244:60: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:247:80: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:248:109: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:249:102: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:250:115: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:251:104: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:254:83: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:258:55: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:263:62: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:266:66: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:267:96: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:268:96: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:271:56: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:274:51: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:275:89: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:276:81: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:277:94: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:278:110: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:279:105: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:280:55: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:281:54: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:282:54: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:283:81: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:284:55: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:285:82: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:286:54: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:287:81: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:292:70: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:293:106: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:294:113: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:298:70: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:299:109: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:300:109: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:301:102: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:302:94: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:303:136: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:304:87: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:309:70: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:310:113: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/EventMonitor.swift:311:121: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/ResponseSerialization.swift:184:19: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/ResponseSerialization.swift:83:19: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/ResponseSerialization.swift:91:19: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/ServerTrustEvaluation.swift:452:19: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Source/Features/ServerTrustEvaluation.swift:454:74: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Alamofire: /Tests/NSLoggingEventMonitor.swift:31:19: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /App/iOS/Delegates/AppState.swift:116:40: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/BrowserViewController/BVC+Playlist.swift:98:39: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/BrowserViewController/BVC+ReaderMode.swift:27:139: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/BrowserViewController/BVC+TabManagerDelegate.swift:163:66: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/BrowserViewController/BVC+Wallet.swift:582:24: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/BrowserViewController/BVC+Wallet.swift:585:25: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/BrowserViewController/BVC+Wallet.swift:625:19: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/BrowserViewController/BVC+Wallet.swift:628:26: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/BrowserViewController/BVC+Wallet.swift:631:33: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/BrowserViewController/BVC+Wallet.swift:634:73: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/BrowserViewController/BVC+Wallet.swift:637:100: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/BrowserViewController/BVC+Wallet.swift:640:66: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/DownloadQueue.swift:36:17: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/DownloadQueue.swift:37:16: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/DownloadQueue.swift:38:17: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/Favicons/UIImageView+Favicon.swift:58:31: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/Handlers/AboutHomeHandler.swift:31:17: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/Handlers/AboutHomeHandler.swift:48:17: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/Handlers/BlockedDomainHandler.swift:15:19: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/Handlers/IPFSSchemeHandler.swift:48:17: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/Handlers/SessionRestoreHandler.swift:109:17: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/Handlers/Web3DomainHandler.swift:84:17: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/Helpers/ErrorPageHelper.swift:75:17: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/Interstitial Pages/InternalSchemeHandler.swift:120:82: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/Playlist/Browser/PlaylistPopoverView.swift:78:15: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/PrivacyProtection/PrivateBrowsingManager.swift:11:17: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/TabManager.swift:1155:75: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/TabManager.swift:1187:97: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/TabManager.swift:1201:66: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/TabManager.swift:1202:69: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/TabManager.swift:1203:55: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/TabManager.swift:1204:82: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/Tabs/TabTray/TabTrayController.swift:832:98: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/Tabs/TabTray/TabTrayController.swift:833:66: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/Tabs/TabTray/TabTrayController.swift:834:69: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/Tabs/TabTray/TabTrayController.swift:835:55: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/Tabs/TabTray/TabTrayController.swift:836:59: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/Tabs/TabTray/TabTrayController.swift:837:82: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/Toolbars/BottomToolbar/Menu/Bookmarks/AddEditBookmarkTableViewController.swift:526:85: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/Toolbars/BottomToolbar/Menu/Bookmarks/AddEditBookmarkTableViewController.swift:530:84: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/Toolbars/UrlBar/PlaylistURLBarButton.swift:112:45: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/Toolbars/UrlBar/TabLocationView.swift:478:36: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/Toolbars/UrlBar/TabLocationView.swift:481:53: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Browser/Toolbars/UrlBar/TabLocationView.swift:547:9: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Reader/ReadabilityService.swift:103:124: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Reader/ReadabilityService.swift:106:102: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Settings/Features/ShieldsPrivacy/AdvancedShieldSettings.swift:123:36: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Settings/Features/ShieldsPrivacy/Clearables.swift:185:10: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Settings/Features/ShieldsPrivacy/Clearables.swift:208:10: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Frontend/Settings/Features/ShieldsPrivacy/Clearables.swift:231:10: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Helpers/TabEventHandler.swift:75:47: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Helpers/TabEventHandler.swift:76:68: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Helpers/TabEventHandler.swift:77:58: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Helpers/TabEventHandler.swift:78:36: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Helpers/TabEventHandler.swift:79:36: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Helpers/TabEventHandler.swift:80:32: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/Helpers/TabEventHandler.swift:81:53: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/Brave/WebFilters/DebouncingService.swift:241:10: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/BraveUI/Popover/PopoverContentComponent.swift:41:66: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/BraveUI/SwiftUI/FixedHeightHostingPanModalController.swift:70:9: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/BraveUI/SwiftUI/TableCellButtonStyle.swift:12:17: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: This PR introduced a violation in Brave: /Sources/BraveUI/SwiftUI/UIKitController.swift:34:89: warning: No Empty Block Violation: Code blocks should contain at least one statement or comment (no_empty_block)
:warning: Danger found 1672 violations with this PR. Due to GitHub's max issue comment size, the number shown has been truncated to 133.
17 Messages
:book: Linting Aerial with this PR took 0.68s vs 0.7s on main (2% faster)
:book: Linting Alamofire with this PR took 0.91s vs 0.92s on main (1% faster)
:book: Linting Brave with this PR took 5.19s vs 5.12s on main (1% slower)
:book: Linting DuckDuckGo with this PR took 2.91s vs 2.88s on main (1% slower)
:book: Linting Firefox with this PR took 8.07s vs 8.09s on main (0% faster)
:book: Linting Kickstarter with this PR took 6.8s vs 6.84s on main (0% faster)
:book: Linting Moya with this PR took 0.42s vs 0.4s on main (4% slower)
:book: Linting NetNewsWire with this PR took 1.81s vs 1.84s on main (1% faster)
:book: Linting Nimble with this PR took 0.56s vs 0.57s on main (1% faster)
:book: Linting PocketCasts with this PR took 6.09s vs 6.11s on main (0% faster)
:book: Linting Quick with this PR took 0.34s vs 0.34s on main (0% slower)
:book: Linting Realm with this PR took 3.42s vs 3.38s on main (1% slower)
:book: Linting Sourcery with this PR took 1.72s vs 1.78s on main (3% faster)
:book: Linting Swift with this PR took 3.13s vs 3.11s on main (0% slower)
:book: Linting VLC with this PR took 0.91s vs 0.93s on main (2% faster)
:book: Linting Wire with this PR took 12.11s vs 12.08s on main (0% slower)
:book: Linting WordPress with this PR took 8.97s vs 8.88s on main (1% slower)

Generated by :no_entry_sign: Danger

SimplyDanny commented 1 week ago

Such a check would actually also make sense for defer blocks and empty struct/class/... declarations. That can be up to an extension. However, to be prepared a name like NoEmptyBlockRule would leave room for these cases.

... and to catch blocks as well like requested in #5634.

Ueeek commented 5 days ago

@SimplyDanny Thank you for reviewing ~. I fixed the review points. Also, support catch and defer as well. And change the rule name as suggested!

SimplyDanny commented 4 days ago

Regarding accessibility modifiers on initializers: While it might be true that explicit modifiers have a potential meaning and are there for a good reason, it's not too easy to find out if the modifier is really required. See how I struggle in #5048 for example and consider

private struct S {
    private init() {}
}

where the private on the initializer is redundant.

So in the first shot of this rule, I'd require the comment in every empty block disregarding access control modifiers. It also doesn't hurt to enforce an explaining comment for these cases. Later we can add this specialization optionally.

SimplyDanny commented 4 days ago

Any reason why

do {}
for _ in 1..<12 {}
while i < 12 {}

should not trigger the rule?

Ueeek commented 3 days ago

@SimplyDanny Thank you for check again. Instead of validating each syntax, validate CodeBlockSyntax so that we can support all type of CodeBlocks.(Accessor, DoCatch, Defer, Deinit, For, Function, if-else, init, repeat and while).

@mildm8nnered Thank you for mention about init. As had discussion above, don't support accessibility modifiers on initializers for now.

Ueeek commented 3 days ago

@mildm8nnered @SimplyDanny Thank you for comments! Fixed all point!

SimplyDanny commented 3 days ago

Awesome first contribution! Thank you, @Ueeek.

marcelofabri commented 3 days ago

I think it’s a bad idea to enable this rule by default. Besides the initializer cases that were caught here, a common case would be creating mock types that need to conform to a protocol, but don’t care about a specific method.

SimplyDanny commented 3 days ago

I think it’s a bad idea to enable this rule by default. Besides the initializer cases that were caught here, a common case would be creating mock types that need to conform to a protocol, but don’t care about a specific method.

I have no strong opinion on that. In my world, all rules could be optional and I enable them specifically. However, it seems like people are often not aware of new optional rules. That's unfortunate. So having some default rules (with a low false positive rate) is actually a nice way to avoid helpful and likeable rules being unused.

Mocks usually appear in test code. Isn't it fine then to disable the rule in these files?

marcelofabri commented 3 days ago

I think it’s a bad idea to enable this rule by default. Besides the initializer cases that were caught here, a common case would be creating mock types that need to conform to a protocol, but don’t care about a specific method.

I have no strong opinion on that. In my world, all rules could be optional and I enable them specifically. However, it seems like people are often not aware of new optional rules. That's unfortunate. So having some default rules (with a low false positive rate) is actually a nice way to avoid helpful and likeable rules being unused.

Mocks usually appear in test code. Isn't it fine then to disable the rule in these files?

It’s a big ask to disable the rule in some files in a large enough codebase. The number of violations in OSS check tells me this should be opt-in.

SimplyDanny commented 3 days ago

I think it’s a bad idea to enable this rule by default. Besides the initializer cases that were caught here, a common case would be creating mock types that need to conform to a protocol, but don’t care about a specific method.

I have no strong opinion on that. In my world, all rules could be optional and I enable them specifically. However, it seems like people are often not aware of new optional rules. That's unfortunate. So having some default rules (with a low false positive rate) is actually a nice way to avoid helpful and likeable rules being unused. Mocks usually appear in test code. Isn't it fine then to disable the rule in these files?

It’s a big ask to disable the rule in some files in a large enough codebase. The number of violations in OSS check tells me this should be opt-in.

What about adding a configuration that allows to disable the rule for certain constructs? Options could be initializer_bodies (which includes deinitializers), function_bodies and statement_blocks (which includes if, for, defer, ...).