Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Abandoned] Fix number of lines reported by function_body_length and type_body_length #1753

Closed
wants to merge 1 commit into from

Conversation

ornithocoder
Copy link
Contributor

@ornithocoder ornithocoder commented Aug 5, 2017

This commit implements a fix for the issue described in #1750. The following rules are returning the incorrect number of lines:

  • function_body_length
  • type_body_length

This PR contains several commits to make the code review easier.

@SwiftLintBot
Copy link

SwiftLintBot commented Aug 5, 2017

540 Warnings
⚠️ This PR introduced a violation in Aerial: /Users/distiller/project/osscheck/Aerial/Aerial/Source/Models/Cache/VideoCache.swift:13:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 208 lines (type_body_length)
⚠️ This PR introduced a violation in Aerial: /Users/distiller/project/osscheck/Aerial/Aerial/Source/Models/Cache/VideoLoader.swift:93:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 43 lines (function_body_length)
⚠️ This PR introduced a violation in Aerial: /Users/distiller/project/osscheck/Aerial/Aerial/Source/Controllers/PreferencesWindowController.swift:366:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 49 lines (function_body_length)
⚠️ This PR introduced a violation in Aerial: /Users/distiller/project/osscheck/Aerial/Aerial/Source/Controllers/PreferencesWindowController.swift:45:1: error: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 367 lines (type_body_length)
⚠️ This PR introduced a violation in Aerial: /Users/distiller/project/osscheck/Aerial/Aerial/Source/Views/AerialView.swift:113:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 44 lines (function_body_length)
⚠️ This PR introduced a violation in Aerial: /Users/distiller/project/osscheck/Aerial/Aerial/Source/Views/AerialView.swift:199:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 51 lines (function_body_length)
⚠️ This PR introduced a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Source/MultipartFormData.swift:45:6: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 287 lines (type_body_length)
⚠️ This PR introduced a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Source/Request.swift:271:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 63 lines (function_body_length)
⚠️ This PR introduced a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Source/ServerTrustPolicy.swift:174:12: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 53 lines (function_body_length)
⚠️ This PR introduced a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Source/SessionManager.swift:653:10: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 59 lines (function_body_length)
⚠️ This PR introduced a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Source/SessionManager.swift:28:6: error: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 473 lines (type_body_length)
⚠️ This PR introduced a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/CacheTests.swift:47:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 216 lines (type_body_length)
⚠️ This PR introduced a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/DownloadTests.swift:485:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 43 lines (function_body_length)
⚠️ This PR introduced a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/DownloadTests.swift:63:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 229 lines (type_body_length)
⚠️ This PR introduced a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/MultipartFormDataTests.swift:305:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 47 lines (function_body_length)
⚠️ This PR introduced a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/MultipartFormDataTests.swift:368:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 47 lines (function_body_length)
⚠️ This PR introduced a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/MultipartFormDataTests.swift:657:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 51 lines (function_body_length)
⚠️ This PR introduced a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/MultipartFormDataTests.swift:724:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 51 lines (function_body_length)
⚠️ This PR introduced a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/MultipartFormDataTests.swift:96:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 242 lines (type_body_length)
⚠️ This PR introduced a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/MultipartFormDataTests.swift:435:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 268 lines (type_body_length)
⚠️ This PR introduced a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/ParameterEncodingTests.swift:35:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 342 lines (type_body_length)
⚠️ This PR introduced a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/ResultTests.swift:29:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 245 lines (type_body_length)
⚠️ This PR introduced a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/SessionDelegateTests.swift:29:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 322 lines (type_body_length)
⚠️ This PR introduced a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/ResponseSerializationTests.swift:36:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 330 lines (type_body_length)
⚠️ This PR introduced a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/ResponseSerializationTests.swift:575:1: error: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 385 lines (type_body_length)
⚠️ This PR introduced a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/SessionManagerTests.swift:797:13: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 44 lines (function_body_length)
⚠️ This PR introduced a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/SessionManagerTests.swift:29:1: error: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 491 lines (type_body_length)
⚠️ This PR introduced a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/TLSEvaluationTests.swift:66:1: error: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 400 lines (type_body_length)
⚠️ This PR introduced a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/ServerTrustPolicyTests.swift:782:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 277 lines (type_body_length)
⚠️ This PR introduced a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/ServerTrustPolicyTests.swift:1215:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 208 lines (type_body_length)
⚠️ This PR introduced a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/UploadTests.swift:170:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 48 lines (function_body_length)
⚠️ This PR introduced a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/UploadTests.swift:537:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 46 lines (function_body_length)
⚠️ This PR introduced a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/UploadTests.swift:537:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 46 lines (function_body_length)
⚠️ This PR introduced a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/UploadTests.swift:602:13: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 70 lines (function_body_length)
⚠️ This PR introduced a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/UploadTests.swift:240:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 348 lines (type_body_length)
⚠️ This PR introduced a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/ValidationTests.swift:336:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 97 lines (function_body_length)
⚠️ This PR introduced a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/ValidationTests.swift:147:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 235 lines (type_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Account/FxADeviceRegistration.swift:79:10: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 54 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Account/FirefoxAccount.swift:26:6: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 335 lines (type_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Account/FxALoginStateMachine.swift:45:17: error: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 124 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Account/FxAClient10.swift:125:6: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 312 lines (type_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Account/FxAState.swift:56:1: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 61 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Application/LeanplumIntegration.swift:117:17: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 64 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Application/AppDelegate.swift:84:36: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 58 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Application/AppDelegate.swift:182:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 61 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Application/AppDelegate.swift:331:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 48 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Application/AppDelegate.swift:25:1: error: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 441 lines (type_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/BrowserViewController/BrowserViewController+WKNavigationDelegate.swift:72:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 60 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/BrowserTrayAnimators.swift:22:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 54 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/BrowserTrayAnimators.swift:112:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 60 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/ButtonToast.swift:67:17: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 57 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/FindInPageBar.swift:56:14: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 70 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/ErrorPageHelper.swift:42:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 85 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/ErrorPageHelper.swift:132:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 66 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/ErrorPageHelper.swift:11:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 201 lines (type_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/OpenSearch.swift:160:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 98 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/Punycode.swift:39:17: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 74 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/QRCodeViewController.swift:21:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 205 lines (type_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/SearchViewController.swift:197:17: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 44 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/SearchViewController.swift:51:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 281 lines (type_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/TabLocationView.swift:52:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 201 lines (type_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/Tab.swift:36:1: error: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 356 lines (type_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/TabManager.swift:355:17: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 58 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/TabManager.swift:719:17: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 42 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/TabManager.swift:40:1: error: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 398 lines (type_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/TabTrayController.swift:429:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 41 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/TabTrayController.swift:238:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 221 lines (type_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/URLBarView.swift:229:17: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 51 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/URLBarView.swift:81:1: error: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 356 lines (type_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/BrowserViewController.swift:190:17: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 50 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/BrowserViewController.swift:315:14: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 64 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/BrowserViewController.swift:615:14: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 53 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/BrowserViewController.swift:859:14: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 44 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/BrowserViewController.swift:1612:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 46 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/BrowserViewController.swift:1883:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 77 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/BrowserViewController.swift:2363:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 57 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/BrowserViewController.swift:2527:5: error: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 101 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/BrowserViewController.swift:39:1: error: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 903 lines (type_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Home/BookmarksPanel.swift:41:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 316 lines (type_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Home/HistoryPanel.swift:457:17: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 55 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Home/HistoryPanel.swift:31:1: error: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 417 lines (type_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Home/ActivityStreamPanel.swift:744:5: error: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 112 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Home/ReaderPanel.swift:271:17: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 58 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Home/RemoteTabsPanel.swift:346:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 49 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Intro/IntroViewController.swift:73:14: error: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 129 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Intro/IntroViewController.swift:52:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 290 lines (type_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Reader/ReaderModeHandlers.swift:11:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 48 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Login Management/LoginListViewController.swift:500:17: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 41 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Reader/ReaderModeStyleViewController.swift:56:14: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 81 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Settings/AppSettingsTableViewController.swift:33:14: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 86 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Settings/HomePageSettingsViewController.swift:18:14: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 43 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Settings/LoginDetailViewController.swift:146:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 47 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Settings/SearchSettingsTableViewController.swift:79:14: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 55 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Settings/SearchSettingsTableViewController.swift:13:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 211 lines (type_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Settings/AppSettingsOptions.swift:236:14: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 49 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Widgets/LoginTableViewCell.swift:235:17: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 64 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Widgets/LoginTableViewCell.swift:39:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 225 lines (type_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Widgets/PhotonActionSheetProtocol.swift:112:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 83 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Widgets/PhotonActionSheet.swift:105:14: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 73 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Widgets/PhotonActionSheet.swift:49:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 216 lines (type_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Widgets/TabsButton.swift:167:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 53 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Utils/FaviconFetcher.swift:131:17: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 56 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Utils/FaviconFetcher.swift:28:6: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 240 lines (type_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Extensions/ShareTo/ShareViewController.swift:72:14: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 81 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Providers/SyncStatusResolver.swift:56:12: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 59 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Push/PushCrypto.swift:174:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 48 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/PushTests/PushCryptoTests.swift:134:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 44 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/PushTests/PushCryptoTests.swift:8:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 214 lines (type_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Providers/Profile.swift:573:12: error: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 525 lines (type_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Providers/Profile.swift:190:6: error: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 790 lines (type_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Shared/Extensions/NSURLExtensions.swift:413:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 48 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Storage/Bookmarks/Trees.swift:198:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 74 lines (function_body_length)
⚠️ This PR introduced a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Storage/Bookmarks/Bookmarks.swift:347:12: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 71 lines (function_body_length)
⚠️ Danger found 540 violations with this PR. Due to GitHub's max issue comment size, the number shown has been truncated to 113.
405 Messages
📖 Linting Aerial with this PR took 0.47s vs 0.4s on master (17% slower)
📖 Linting Alamofire with this PR took 3.42s vs 3.33s on master (2% slower)
📖 Linting Firefox with this PR took 13.7s vs 13.86s on master (1% faster)
📖 Linting Kickstarter with this PR took 21.42s vs 21.95s on master (2% faster)
📖 Linting Moya with this PR took 1.89s vs 1.89s on master (0% slower)
📖 Linting Nimble with this PR took 2.03s vs 2.04s on master (0% faster)
📖 Linting Quick with this PR took 0.59s vs 0.59s on master (0% slower)
📖 Linting Realm with this PR took 3.68s vs 3.55s on master (3% slower)
📖 Linting SourceKitten with this PR took 1.15s vs 1.1s on master (4% slower)
📖 Linting Sourcery with this PR took 4.8s vs 4.52s on master (6% slower)
📖 Linting Swift with this PR took 15.27s vs 15.12s on master (0% slower)
📖 Linting WordPress with this PR took 13.23s vs 13.32s on master (0% faster)
📖 This PR fixed a violation in Aerial: /Users/distiller/project/osscheck/Aerial/Aerial/Source/Controllers/PreferencesWindowController.swift:366:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 44 lines (function_body_length)
📖 This PR fixed a violation in Aerial: /Users/distiller/project/osscheck/Aerial/Aerial/Source/Controllers/PreferencesWindowController.swift:45:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 300 lines (type_body_length)
📖 This PR fixed a violation in Aerial: /Users/distiller/project/osscheck/Aerial/Aerial/Source/Views/AerialView.swift:199:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 45 lines (function_body_length)
📖 This PR fixed a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Source/MultipartFormData.swift:45:6: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 222 lines (type_body_length)
📖 This PR fixed a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Source/Request.swift:271:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 47 lines (function_body_length)
📖 This PR fixed a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Source/ServerTrustPolicy.swift:174:12: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 43 lines (function_body_length)
📖 This PR fixed a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Source/SessionManager.swift:653:10: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 46 lines (function_body_length)
📖 This PR fixed a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Source/SessionManager.swift:28:6: error: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 382 lines (type_body_length)
📖 This PR fixed a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/ParameterEncodingTests.swift:35:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 272 lines (type_body_length)
📖 This PR fixed a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/MultipartFormDataTests.swift:305:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 41 lines (function_body_length)
📖 This PR fixed a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/MultipartFormDataTests.swift:368:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 41 lines (function_body_length)
📖 This PR fixed a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/MultipartFormDataTests.swift:657:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 45 lines (function_body_length)
📖 This PR fixed a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/MultipartFormDataTests.swift:724:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 45 lines (function_body_length)
📖 This PR fixed a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/MultipartFormDataTests.swift:96:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 208 lines (type_body_length)
📖 This PR fixed a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/MultipartFormDataTests.swift:435:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 234 lines (type_body_length)
📖 This PR fixed a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/SessionDelegateTests.swift:29:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 272 lines (type_body_length)
📖 This PR fixed a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/ResponseSerializationTests.swift:36:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 279 lines (type_body_length)
📖 This PR fixed a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/ResponseSerializationTests.swift:575:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 325 lines (type_body_length)
📖 This PR fixed a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/SessionManagerTests.swift:29:1: error: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 421 lines (type_body_length)
📖 This PR fixed a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/TLSEvaluationTests.swift:66:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 319 lines (type_body_length)
📖 This PR fixed a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/UploadTests.swift:602:13: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 55 lines (function_body_length)
📖 This PR fixed a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/UploadTests.swift:240:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 276 lines (type_body_length)
📖 This PR fixed a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/ServerTrustPolicyTests.swift:782:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 235 lines (type_body_length)
📖 This PR fixed a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Tests/ValidationTests.swift:336:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 80 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Account/FxADeviceRegistration.swift:79:10: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 44 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Account/FirefoxAccount.swift:26:6: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 264 lines (type_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Account/FxALoginStateMachine.swift:45:17: error: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 108 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Account/FxAClient10.swift:125:6: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 250 lines (type_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Account/FxAState.swift:56:1: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 53 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Application/LeanplumIntegration.swift:117:17: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 50 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Application/AppDelegate.swift:84:36: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 51 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Application/AppDelegate.swift:182:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 55 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Application/AppDelegate.swift:25:1: error: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 355 lines (type_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/BrowserViewController/BrowserViewController+WKNavigationDelegate.swift:72:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 46 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/BrowserTrayAnimators.swift:22:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 52 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/BrowserTrayAnimators.swift:112:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 57 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/ButtonToast.swift:67:17: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 52 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/FindInPageBar.swift:56:14: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 64 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/ErrorPageHelper.swift:42:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 84 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/ErrorPageHelper.swift:132:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 55 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/OpenSearch.swift:160:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 77 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/Punycode.swift:39:17: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 60 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/SearchViewController.swift:51:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 219 lines (type_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/Tab.swift:36:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 265 lines (type_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/TabManager.swift:355:17: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 45 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/TabManager.swift:40:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 306 lines (type_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/BrowserViewController.swift:190:17: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 42 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/BrowserViewController.swift:315:14: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 57 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/BrowserViewController.swift:615:14: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 42 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/BrowserViewController.swift:1612:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 44 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/BrowserViewController.swift:1883:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 60 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/BrowserViewController.swift:2363:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 48 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/BrowserViewController.swift:2527:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 79 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/BrowserViewController.swift:39:1: error: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 705 lines (type_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/URLBarView.swift:81:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 282 lines (type_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Home/BookmarksPanel.swift:41:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 243 lines (type_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Home/HistoryPanel.swift:31:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 317 lines (type_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Home/ReaderPanel.swift:271:17: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 53 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Home/ActivityStreamPanel.swift:744:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 90 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Intro/IntroViewController.swift:73:14: error: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 116 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Intro/IntroViewController.swift:52:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 242 lines (type_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Home/RemoteTabsPanel.swift:346:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 46 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Settings/AppSettingsTableViewController.swift:33:14: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 73 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Reader/ReaderModeStyleViewController.swift:56:14: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 70 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Settings/LoginDetailViewController.swift:146:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 46 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Settings/SearchSettingsTableViewController.swift:79:14: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 52 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Settings/AppSettingsOptions.swift:236:14: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 43 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Widgets/LoginTableViewCell.swift:235:17: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 51 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Widgets/PhotonActionSheetProtocol.swift:112:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 65 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Widgets/PhotonActionSheet.swift:105:14: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 63 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Widgets/TabsButton.swift:167:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 48 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Utils/FaviconFetcher.swift:131:17: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 44 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Extensions/ShareTo/ShareViewController.swift:72:14: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 78 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Providers/SyncStatusResolver.swift:56:12: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 51 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Push/PushCrypto.swift:174:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 44 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Providers/Profile.swift:573:12: error: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 408 lines (type_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Providers/Profile.swift:190:6: error: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 608 lines (type_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Shared/Extensions/NSURLExtensions.swift:413:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 43 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Storage/Bookmarks/Trees.swift:198:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 62 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Storage/Bookmarks/Bookmarks.swift:347:12: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 59 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Storage/Bookmarks/Bookmarks.swift:226:8: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 223 lines (type_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Storage/Logins.swift:469:10: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 60 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Storage/Logins.swift:125:6: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 243 lines (type_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Storage/SQL/BrowserSchema.swift:604:12: error: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 135 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Storage/SQL/BrowserSchema.swift:772:12: error: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 212 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Storage/SQL/BrowserSchema.swift:130:6: error: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 812 lines (type_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Storage/SQL/SQLiteBookmarksModel.swift:308:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 47 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Storage/SQL/SQLiteHistory.swift:454:17: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 98 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Storage/SQL/SQLiteBookmarksSyncing.swift:120:17: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 79 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Storage/SQL/SQLiteBookmarksSyncing.swift:974:12: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 99 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Storage/SQL/SQLiteBookmarksSyncing.swift:1123:12: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 62 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Storage/SQL/SQLiteRemoteClientsAndTabs.swift:12:6: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 201 lines (type_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Storage/SQL/SQLiteLogins.swift:250:10: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 42 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Storage/SQL/SQLiteLogins.swift:12:6: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 314 lines (type_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Sync/State.swift:432:17: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 49 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Sync/State.swift:194:6: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 243 lines (type_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Sync/Synchronizers/Bookmarks/BookmarksRepairRequestor.swift:194:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 43 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Sync/Synchronizers/Bookmarks/BookmarksRepairRequestor.swift:278:13: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 58 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Sync/Synchronizers/Bookmarks/BookmarksRepairRequestor.swift:116:1: warning: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 268 lines (type_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Sync/Synchronizers/Bookmarks/BookmarksSynchronizer.swift:164:10: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 64 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Sync/Synchronizers/TabsSynchronizer.swift:88:10: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 52 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Sync/Synchronizers/Bookmarks/ThreeWayTreeMerger.swift:278:17: error: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 167 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Sync/Synchronizers/Bookmarks/ThreeWayTreeMerger.swift:638:17: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 44 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Sync/Synchronizers/Bookmarks/ThreeWayTreeMerger.swift:860:5: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 56 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Sync/Synchronizers/Bookmarks/ThreeWayTreeMerger.swift:1132:9: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 56 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Sync/Synchronizers/Bookmarks/ThreeWayTreeMerger.swift:1229:9: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 43 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Sync/Synchronizers/Bookmarks/ThreeWayTreeMerger.swift:1127:5: error: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 161 lines (function_body_length)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Sync/Synchronizers/Bookmarks/ThreeWayTreeMerger.swift:126:1: error: Type Body Length Violation: Type body should span 200 lines or less excluding comments and whitespace: currently spans 671 lines (type_body_length)
📖 This PR fixed a violation in Kickstarter: /Users/distiller/project/osscheck/Kickstarter/Kickstarter-iOS/AppDelegate.swift:29:3: error: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 123 lines (function_body_length)
📖 This PR fixed a violation in Kickstarter: /Users/distiller/project/osscheck/Kickstarter/Kickstarter-iOS/DataSources/LiveStreamDiscoveryDataSourceTests.swift:12:3: warning: Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 45 lines (function_body_length)
⚠️ Danger found 405 violations with this PR. Due to GitHub's max issue comment size, the number shown has been truncated to 122.

Generated by 🚫 Danger

@codecov-io
Copy link

codecov-io commented Aug 5, 2017

Codecov Report

❗ No coverage uploaded for pull request base (master@a03f8f8). Click here to learn what that means.
The diff coverage is 97.5%.

Impacted file tree graph

@@           Coverage Diff            @@
##             master   #1753   +/-   ##
========================================
  Coverage          ?   88.8%           
========================================
  Files             ?     244           
  Lines             ?   11902           
  Branches          ?       0           
========================================
  Hits              ?   10570           
  Misses            ?    1332           
  Partials          ?       0
Impacted Files Coverage Δ
...iftlint/Extensions/Configuration+CommandLine.swift 0% <0%> (ø)
.../SwiftLintFramework/Rules/TypeBodyLengthRule.swift 100% <100%> (ø)
...urce/SwiftLintFramework/Rules/FileHeaderRule.swift 91.37% <100%> (ø)
...ntFrameworkTests/FunctionBodyLengthRuleTests.swift 100% <100%> (ø)
Tests/SwiftLintFrameworkTests/TestHelpers.swift 72.25% <100%> (ø)
...SwiftLintFramework/Extensions/File+SwiftLint.swift 93.45% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a03f8f8...5dfed75. Read the comment docs.

@ornithocoder ornithocoder changed the title [WIP]: Fix for the number of lines reported by File.numberOfCommentAndWhitespaceOnlyLines (startLine:endLine:) Fix for the number of lines reported by File.numberOfCommentAndWhitespaceOnlyLines (startLine:endLine:) Aug 5, 2017
@ornithocoder ornithocoder force-pushed the blank_line branch 3 times, most recently from 47d1d57 to 81fb8a6 Compare August 7, 2017 08:37
@marcelofabri
Copy link
Collaborator

Reminder to my future self: run oss-check locally to see if this impacts the performance.

@ornithocoder
Copy link
Contributor Author

@marcelofabri I'll try to cache the result. Changing it to WIP for now.

@ornithocoder ornithocoder changed the title Fix for the number of lines reported by File.numberOfCommentAndWhitespaceOnlyLines (startLine:endLine:) [WIP] Fix for the number of lines reported by .numberOfCommentAndWhitespaceOnlyLines Aug 7, 2017
@ornithocoder
Copy link
Contributor Author

ornithocoder commented Aug 7, 2017

@marcelofabri I've tried the cached version, but got the same results. Cache implementation can be found in this gist https://gist.github.com/ornithocoder/eb4b407fdbd8e74cbeb3d7bdb0254bd9.

The result is pretty much the same, but honestly, I prefer the cache implementation better and am thinking of pushing it. What do you think?

@marcelofabri
Copy link
Collaborator

Since the results are the same, I wouldn't add the cache to keep things simpler. One thing that might help is to only evaluate let isEmpty = line.content.trimmingCharacters(in: .whitespaces).isEmpty if comment is true.

@ornithocoder ornithocoder changed the title [WIP] Fix for the number of lines reported by .numberOfCommentAndWhitespaceOnlyLines Fix for the number of lines reported by .numberOfCommentAndWhitespaceOnlyLines Aug 7, 2017
@ornithocoder ornithocoder changed the title Fix for the number of lines reported by .numberOfCommentAndWhitespaceOnlyLines Fix number of lines reported by .numberOfCommentAndWhitespaceOnlyLines() Aug 8, 2017
@ornithocoder
Copy link
Contributor Author

ornithocoder commented Aug 9, 2017

@marcelofabri I decided to give it another try and increased the number of iterations to 20. Got much better results this time.

@ornithocoder ornithocoder force-pushed the blank_line branch 3 times, most recently from 4a228ef to 40de68e Compare August 9, 2017 14:45
@ornithocoder
Copy link
Contributor Author

@marcelofabri @jpsim this one is ready for code review. I changed #1747 to WIP because I want to rebase that one once the number of lines issue is fixed.

@ornithocoder ornithocoder changed the title Fix number of lines reported by .numberOfCommentAndWhitespaceOnlyLines() Fix number of lines reported by function_body_length and type_body_length Aug 13, 2017
@marcelofabri
Copy link
Collaborator

@ornithocoder Just to let you know that I didn't forget about this one. However, this needs a more careful review and I haven't got time yet. 😬

@ornithocoder ornithocoder force-pushed the blank_line branch 4 times, most recently from 0fbef60 to c14a67d Compare August 21, 2017 09:34
@ornithocoder ornithocoder force-pushed the blank_line branch 3 times, most recently from 659ab6f to e9d738f Compare August 29, 2017 06:30
@ornithocoder
Copy link
Contributor Author

@marcelofabri I've rebased so it shows the performance impact before all the other messages.

@ornithocoder
Copy link
Contributor Author

ornithocoder commented Sep 4, 2017

Hi @marcelofabri @jpsim, any updates on this one? I know it looks like a long PR, but in fact it isn't. The first commit contains the real changes to improve the way the number of lines is calculated and the second one is just to adapt SwiftLint's codebase so function_body_length and type_body_length don't throw any violations.

If there's anything I can do to make it easier to review, please let me know.

@ornithocoder
Copy link
Contributor Author

@marcelofabri @jpsim should I keep rebasing to resolve the CHANGELOG.md conflict or wait for the review first?

@marcelofabri
Copy link
Collaborator

I thought about it and I think we probably should raise the default limits instead of applying those fixes. Most of them don't make code easier to read IMO.

Or we can even keep the current behavior of considering things that are not tokens (}) not relevant and just improve the messages.

I'd love to hear @jpsim's thoughts on this too.

@ornithocoder
Copy link
Contributor Author

ornithocoder commented Sep 14, 2017

I like the idea of applying the first commit (fix) and increasing the default values ;-)

@ornithocoder
Copy link
Contributor Author

I've update the PR w/ fix + new default values. I still have the old commit in a different branch, just in case ;-) @marcelofabri @jpsim

@ornithocoder
Copy link
Contributor Author

@jpsim what's your opinion on increasing the default values for function_body_length from 40 to 50 and type_body_length from 200 to 250?

@ornithocoder
Copy link
Contributor Author

ornithocoder commented Oct 5, 2017

Hi folks. Any chance of getting this into master?

@ornithocoder
Copy link
Contributor Author

@jpsim @marcelofabri function_body_length and type_body_length are currently reporting the wrong number of lines. Any chance of getting this into master? It's a simple change with pretty much no performance impact. For the new default values I've used SwiftLint as baseline. Oh, and it also unblocks me to submit a pull request for #52. Thanks.

@jpsim
Copy link
Collaborator

jpsim commented Nov 3, 2017

Finally took a first pass at reviewing this. I agree that if caching results doesn't impact performance, we simply shouldn't cache results to simplify this change.

Also, this seems overly complex for what it's trying to do, but maybe I'm missing something?

Why isn't this PR as simple as just this:

fileprivate func numberOfCommentAndWhitespaceOnlyLines(startLine: Int, endLine: Int) -> Int {
    let commentKinds = SyntaxKind.commentKinds
    let linesAndSyntaxKinds = zip(lines[(startLine - 1)...(endLine - 1)], syntaxKindsByLines[startLine...endLine])
    return linesAndSyntaxKinds.filter { line, kinds in
        let whitespaceOnly = line.content.trimmingCharacters(in: .whitespaces).isEmpty
        if whitespaceOnly { return true }
        let commentOnly = kinds.filter { !commentKinds.contains($0) }.isEmpty
        return commentOnly
    }.count
}

@ornithocoder
Copy link
Contributor Author

@jpsim thanks! That's pretty close to the original implementation we had, but for some stupid reason I decided to insist on the cached version :-) I'm pushing a new version that doesn't cache.

@@ -9,7 +9,7 @@
import SourceKittenFramework

public struct FunctionBodyLengthRule: ASTRule, ConfigurationProviderRule {
public var configuration = SeverityLevelsConfiguration(warning: 40, error: 100)
public var configuration = SeverityLevelsConfiguration(warning: 50, error: 100)
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's the motivation for this change and why isn't it noted in the changelog?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The number of violations it throws for the SwiftLint codebase. See here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

You can override default configuration values in .swiftlint.yml.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

guard !isSwiftLintCommand(token: token, file: file) else {
continue
}
guard !isSwiftLintCommand(token: token, file: file) else { continue }
Copy link
Collaborator

Choose a reason for hiding this comment

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

This doesn't help with readability.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree. Any suggestion to decrease the number of lines there to avoid throwing a violation because of the number of lines?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Could split up into multiple functions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted.


return linesAndSyntaxKinds.filter { line, kinds in
let isLineEmpty = line.content.trimmingCharacters(in: .whitespaces).isEmpty
return isLineEmpty ? true : !kinds.filter { commentKinds.contains($0) }.isEmpty
Copy link
Collaborator

Choose a reason for hiding this comment

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

As a general rule, filter { contains }.isEmpty can always be restructured to contains { contains }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll try to improve it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be fixed now. Thanks!

XCTAssertEqual(violations(longFunctionBody), [])

let longerFunctionBody = violatingFuncWithBody(repeatElement("x = 0\n", count: 40).joined())
XCTAssertEqual(violations(longerFunctionBody), [StyleViolation(
ruleDescription: FunctionBodyLengthRule.description,
location: Location(file: nil, line: 1, character: 1),
reason: "Function body should span 40 lines or less excluding comments and " +
"whitespace: currently spans 41 lines")])
"whitespace: currently spans 42 lines")])
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry, I fail to see how this was previously incorrect and is now correct.

We're adding 40 lines to the function body additional to its first line:

violatingFuncWithBody(repeatElement("x = 0\n", count: 40).joined())

So the body should be considered to span 41 lines.

Where are you getting 42 from?

Copy link
Contributor Author

@ornithocoder ornithocoder Nov 14, 2017

Choose a reason for hiding this comment

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

screen shot 2017-11-14 at 9 49 56 am

I didn't touch the logic in

    internal func exceedsLineCountExcludingCommentsAndWhitespace(_ start: Int, _ end: Int,
                                                                 _ limit: Int) -> (Bool, Int) {
        guard end - start > limit else {
            return (false, end - start)
        }

        let count = end - start - numberOfCommentAndWhitespaceOnlyLines(startLine: start, endLine: end)
        return (count > limit, count)
    }

which takes the endLine - startLine.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Except that the counts did change, you even had to change the tests to accommodate it.

If you look at your screenshot, the body spans from line 2 to line 42, meaning 41 lines.

Copy link
Contributor Author

@ornithocoder ornithocoder Nov 14, 2017

Choose a reason for hiding this comment

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

That's because the last line contains a single "}" and was computed as empty line :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So the problem now isn't the numberOfCommentAndWhitespaceOnlyLines(startLine:endLine). it now reports the correct number of lines that don't have code. Rules that use exceedsLineCountExcludingCommentsAndWhitespace(_:_:_:) have to be changed to pass the correct start line and end line of blocks.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I wouldn't count that as the body. i.e. this function should have a body line count of 2:

func foo() { // not body
  _ = 0 // body line 1
  
  // not body, neither is above
  _ = 0 // body line 2
} // not body

Copy link
Contributor Author

@ornithocoder ornithocoder Nov 14, 2017

Choose a reason for hiding this comment

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

I agree, but that's a different problem. Now,

  • numberOfCommentAndWhitespaceOnlyLines, and
  • exceedsLineCountExcludingCommentsAndWhitespace

report the correct number of lines with this PR.

What needs to be changed now are the rules that use exceedsLineCountExcludingCommentsAndWhitespace.

The only reason why the rule was reporting the correct number of lines (41) was because numberOfCommentAndWhitespaceOnlyLines was reporting the wrong of valid lines of code. One bug was hiding the other.

Next step is to review all _length rules to pass the correct startLine and endLine to exceedsLineCountExcludingCommentsAndWhitespaceexceedsLineCountExcludingCommentsAndWhitespace.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll squash some of these the commits as "Fixes numberOfCommentAndWhitespaceOnlyLines" and will changed it to WIP, while the rules are not fixed.

@@ -270,8 +270,11 @@ extension File {

fileprivate func numberOfCommentAndWhitespaceOnlyLines(startLine: Int, endLine: Int) -> Int {
let commentKinds = SyntaxKind.commentKinds
return syntaxKindsByLines[startLine...endLine].filter { kinds in
kinds.filter { !commentKinds.contains($0) }.isEmpty
let linesAndSyntaxKinds = zip(lines[(startLine - 1)...(endLine - 1)], syntaxKindsByLines[startLine...endLine])
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about this?

return (startLine...endLine).filter { lineNumber in
    let line = lines[lineNumber - 1]
    let isLineEmpty = line.content.rangeOfCharacter(from: CharacterSet.whitespaces.inverted) == nil
    if isLineEmpty { return true }

    return syntaxKindsByLines[lineNumber].contains(where: SyntaxKind.commentKinds.contains)
}.count

It's simpler (IMHO) and more optimized because it avoids unconditionally iterating over all characters in the string, allocating a new string, and mutating it once for every whitespace character.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@ornithocoder ornithocoder force-pushed the blank_line branch 3 times, most recently from feb0e3a to 3f99774 Compare November 14, 2017 22:56
@ornithocoder ornithocoder changed the title Fix number of lines reported by function_body_length and type_body_length [WIP] Fix number of lines reported by function_body_length and type_body_length Nov 15, 2017
This commit implements a fix for the issue described in realm#1750. The
following rules are returning the incorrect number of lines:

* `function_body_length`
* `type_body_length`

This commit:

* updates `numberOfCommentAndWhitespaceOnlyLines` to count lines that
  include the characters { and } as valid lines of code.

  With the change, the three lines below _are_ valid lines of code:

  if a == b {
      a.foo()
  }

  Before the fix, only the first two were valid lines.

* updates `exceedsLineCountExcludingCommentsAndWhitespace` to take the
  number of lines in consideration rather than the difference between
  two line numbers. For instance, the span between lines 1 and 6 is 4
  (lines 2, 3, 4, and 5) instead of 5 (endline - startline).
@ornithocoder
Copy link
Contributor Author

ornithocoder commented Nov 17, 2017

Hi @jpsim @marcelofabri, since the method to count the number of lines doesn't understand context (and it shouldn't, so it can be reused for type length, closure length, function length, etc...), it's important to call it with the correct startLine and lastLine.

I'm struggling to find the correct firstLine and finalLine for the rule function_body_length. Right now it passes the line where the function starts (line containing the "{") and line where the function ends "}". But by passing these two lines, they are counted are valid lines. For instance,

passing 1 and 3 for the code below

1 func foo() {
2
3 }

it returns two valid lines - not empty and not comment - (1 and 3) and one line with empty content (2).

So I'm looking for a way to change the function_body_length rule to pass the actual line where the function content starts. For instance:

1 func foo() {
2
3 }

firstLine = 2, lastLine = 2
total number of lines in function = (2...2).count = 1, valid lines = 0
1 func foo() {
2   _ = 0
3
4   _ = 0
5 }

firstLine = 2, lastLine = 4
total number of lines in function = (2...4).count = 3, valid lines = 2
1 func foo() {
2   _ = 0
3
4   _ = 0 }

firstLine = 2, lastLine = 4
total number of lines = (2...4).count = 3, valid lines = 2
1 func foo() { }

firstLine = 1, lastLine = 1
total number of lines = (1...1).count = 1
1 func foo() -> Int { return 0 }

firstLine = 1, lastLine = 1
total number of lines = (1...1).count = 1

Any idea how can I achieve this?

Recap:

  1. numberOfCommentAndWhitespaceOnlyLines(startLine:endLine) was not counting lines with "{" and "}", so for long functions with ifs, elses, guards, etc... the number of valid lines was way off.
  2. Fixing numberOfCommentAndWhitespaceOnlyLines(startLine:endLine) highlighted another issue, that the rules are not passing the correct start line and end line. Since { and } where not computed by the first issue, this was never a problem. But with the fix, the last line (which contains a single "}") is computed causing all the issues @jpsim noticies above on the code review.
  3. I need help to fix the function_body_length to pass the correct firstLine and lastLine.

I've pushed a workaround that includes a inclusive flag so functions using the numberOfCommentAndWhitespaceOnlyLines can specify if they want to count the first and last line or not. But this is a workaround. I would like to pass the correct firstLine and lastLine instead.

Thanks.

@ornithocoder ornithocoder changed the title [WIP] Fix number of lines reported by function_body_length and type_body_length [Abandoned] Fix number of lines reported by function_body_length and type_body_length Jan 15, 2018
@ornithocoder
Copy link
Contributor Author

I'll have to find another way to

  1. fix the number of lines reported
  2. find where a function starts and ends.

I'm abandoning this PR to start fresh on this issue.

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.

5 participants