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

ci: Detect unused code with Periphery #1401

Merged
merged 7 commits into from
Apr 30, 2024
Merged

ci: Detect unused code with Periphery #1401

merged 7 commits into from
Apr 30, 2024

Conversation

PhilippeWeidmann
Copy link
Member

@PhilippeWeidmann PhilippeWeidmann commented Apr 26, 2024

Unused code is now detected using periphery. (https://github.com/peripheryapp/periphery)
For every PR a comment is generated which gives a list of unused code + the count.

Copy link

github-actions bot commented Apr 29, 2024

Found 137 unused code occurences

Expand
Mail/Components/ActionsPanelButton.swift:21:1: warning: Imported module 'MailResources' is unused
Mail/Components/Custom Buttons/AccountButton.swift:22:1: warning: Imported module 'MailResources' is unused
Mail/Components/ThreadCell/ThreadCell.swift:114:17: warning: Property 'checkboxSize' is unused
Mail/DisplayThreadScene.swift:20:1: warning: Imported module 'MailResources' is unused
Mail/Helpers/MailTargetAssembly.swift:57:7: warning: Class 'MailTargetAssembly' is unused
Mail/Helpers/RichTextEditor.swift:169:10: warning: Function 'insertHtml(_:)' is unused
Mail/Helpers/RichTextEditor.swift:282:10: warning: Function 'moveCursorToEnd(completion:)' is unused
Mail/Helpers/RichTextEditor.swift:286:10: warning: Function 'addBold(completion:)' is unused
Mail/Helpers/RichTextEditor.swift:294:10: warning: Function 'removeList(completion:)' is unused
Mail/MailApp.swift:28:1: warning: Imported module 'MailResources' is unused
Mail/MailApp.swift:35:17: warning: Property 'dependencyInjectionHook' is unused
Mail/Proxy/Implementation/MessageActionHandler.swift:69:58: warning: Parameter 'mailbox' is unused
Mail/Proxy/Implementation/MessageActionHandler.swift:83:57: warning: Parameter 'mailbox' is unused
Mail/Proxy/Protocols/MessageActionHandlable.swift:28:58: warning: Parameter 'mailbox' is unused
Mail/Proxy/Protocols/MessageActionHandlable.swift:31:57: warning: Parameter 'mailbox' is unused
Mail/UserAccountScene.swift:37:36: warning: Property 'accountManager' is unused
Mail/Utils/DateInterval+Extension.swift:23:16: warning: Property 'future' is unused
Mail/Utils/IntentViewable.swift:24:9: warning: Property 'resolvedIntent' is unused
Mail/Utils/IntentViewable.swift:25:10: warning: Function 'initFromIntent()' is unused
Mail/Views/AI Writer/AIModel.swift:324:5: warning: Initializer 'init(from:)' is unused
Mail/Views/AI Writer/Prompt/AIEngineOptionButton.swift:31:18: warning: Property 'isShowingAIEngineChoice' is assigned, but never used
Mail/Views/Attachment/AttachmentPreview.swift:32:36: warning: Property 'urlOpener' is unused
Mail/Views/Bottom sheets/Actions/ContactActionsView/ContactActionsView.swift:24:1: warning: Imported module 'MailResources' is unused
Mail/Views/Bottom sheets/Calendar/CalendarAllAttendeesView.swift:22:1: warning: Imported module 'MailResources' is unused
Mail/Views/Menu Drawer/FolderListView.swift:22:1: warning: Imported module 'MailResources' is unused
Mail/Views/Menu Drawer/FolderListViewModel.swift:35:17: warning: Property 'foldersObservationToken' is assigned, but never used
Mail/Views/Menu Drawer/Folders/FoldersListView.swift:22:1: warning: Imported module 'MailResources' is unused
Mail/Views/Menu Drawer/MenuDrawerView.swift:124:24: warning: Property 'isShowingRestoreMails' is unused
Mail/Views/New Message/Attachments/AttachmentsManager.swift:28:21: warning: Protocol 'AttachmentsManageable' is redundant as it's never used as an existential type
Mail/Views/New Message/Attachments/AttachmentsManager.swift:66:62: warning: Protocol 'AttachmentsManageable' conformance is redundant
Mail/Views/New Message/Attachments/AttachmentsManager.swift:66:62: warning: Protocol 'AttachmentsManageable' conformance is redundant
Mail/Views/New Message/Attachments/AttachmentsManager.swift:67:17: warning: Property 'draftLocalUUID' is assigned, but never used
Mail/Views/New Message/Attachments/AttachmentsManager.swift:72:17: warning: Property 'mailboxManager' is assigned, but never used
Mail/Views/New Message/Attachments/AttachmentsManager.swift:73:17: warning: Property 'backgroundRealm' is assigned, but never used
Mail/Views/New Message/Attachments/AttachmentsManager.swift:79:9: warning: Property 'liveDraft' is unused
Mail/Views/New Message/AutocompletionView.swift:22:1: warning: Imported module 'MailResources' is unused
Mail/Views/New Message/ComposeMessageBodyView.swift:35:18: warning: Property 'currentSignature' is assigned, but never used
Mail/Views/New Message/ComposeMessageIntentView.swift:23:1: warning: Imported module 'MailResources' is unused
Mail/Views/New Message/ComposeMessageIntentView.swift:44:9: warning: Property 'htmlAttachments' is assigned, but never used
Mail/Views/New Message/Header Cells/ComposeMessageSenderMenu.swift:22:1: warning: Imported module 'MailResources' is unused
Mail/Views/New Message/Header Cells/ComposeMessageSenderMenu.swift:27:36: warning: Property 'draftContentManager' is unused
Mail/Views/New Message/Header Cells/ComposeMessageSenderMenu.swift:35:9: warning: Property 'text' is assigned, but never used
Mail/Views/New Message/RecipientField.swift:30:24: warning: Property 'keyboardHeight' is assigned, but never used
Mail/Views/New Message/RecipientField.swift:41:17: warning: Property 'trimmedInputText' is unused
Mail/Views/New Message/Recipients/RecipientChip.swift:34:21: warning: Property 'focusedField' is assigned, but never used
Mail/Views/New Message/Select Mailbox/AccountMailboxesListView.swift:23:1: warning: Imported module 'MailResources' is unused
Mail/Views/New Message/Select Mailbox/AccountMailboxesListView.swift:27:36: warning: Property 'accountManager' is unused
Mail/Views/New Message/Select Mailbox/AccountMailboxesListView.swift:36:17: warning: Property 'currentMailbox' is unused
Mail/Views/New Message/Select Mailbox/CurrentComposeMailboxView.swift:30:36: warning: Property 'matomo' is unused
Mail/Views/New Message/Select Mailbox/SelectComposeMailboxView.swift:29:36: warning: Property 'matomo' is unused
Mail/Views/New Message/Select Mailbox/SelectComposeMailboxView.swift:30:36: warning: Property 'platformDetector' is unused
Mail/Views/New Message/Select Mailbox/SelectComposeMailboxView.swift:34:18: warning: Property 'composeMessageIntent' is assigned, but never used
Mail/Views/Onboarding/AuthorizationView.swift:33:36: warning: Property 'matomo' is unused
Mail/Views/Onboarding/AuthorizationView.swift:121:8: warning: Struct 'AuthorizationView_Previews' is unused
Mail/Views/Onboarding/OnboardingView.swift:350:8: warning: Struct 'OnboardingView_Previews' is unused
Mail/Views/Onboarding/SlideView.swift:117:8: warning: Struct 'SlideView_Previews' is unused
Mail/Views/Search/SearchHistorySectionView.swift:26:36: warning: Property 'mailboxManager' is unused
Mail/Views/Search/SearchViewModel.swift:94:9: warning: Property 'lastSearchFolderId' is assigned, but never used
Mail/Views/Settings/Appearance/SkeletonSwipeCell.swift:19:1: warning: Imported module 'MailCore' is unused
Mail/Views/Settings/Appearance/SkeletonSwipeCell.swift:20:1: warning: Imported module 'MailResources' is unused
Mail/Views/Settings/General/SettingsNotificationsInstructionsView.swift:25:33: warning: Property 'openURL' is unused
Mail/Views/Settings/General/SettingsNotificationsView.swift:32:36: warning: Property 'platformDetector' is unused
Mail/Views/Settings/General/SettingsNotificationsView.swift:36:41: warning: Property 'openURL' is unused
Mail/Views/Settings/Other/SendSettingsView.swift:25:24: warning: Property 'includeOriginal' is unused
Mail/Views/Settings/Other/SendSettingsView.swift:26:24: warning: Property 'askAck' is unused
Mail/Views/Settings/SettingsView.swift:38:49: warning: Property 'isCompactWindow' is unused
Mail/Views/SplitView.swift:25:1: warning: Imported module 'MailResources' is unused
Mail/Views/SplitView.swift:335:51: warning: Parameter 'notification' is unused
Mail/Views/Switch User/AccountListView.swift:39:17: warning: Property 'mailboxObservationToken' is assigned, but never used
Mail/Views/Switch User/CreateAccountView.swift:32:36: warning: Property 'platformDetector' is unused
Mail/Views/Switch User/DeleteAccountView.swift:21:1: warning: Imported module 'MailCore' is unused
Mail/Views/Sync Profile/SyncProfileNavigationView.swift:20:1: warning: Imported module 'MailResources' is unused
Mail/Views/TextStylePreview.swift:19:1: warning: Imported module 'MailResources' is unused
Mail/Views/Thread List/FlushFolderView.swift:41:18: warning: Property 'flushAlert' is assigned, but never used
Mail/Views/Thread List/ThreadListCell.swift:24:1: warning: Imported module 'MailResources' is unused
Mail/Views/Thread List/ThreadListHeader.swift:36:17: warning: Property 'folderObservation' is assigned, but never used
Mail/Views/Thread List/ThreadListMultipleSectionViewModel.swift:24:1: warning: Imported module 'MailResources' is unused
Mail/Views/Thread List/ThreadListSwipeAction.swift:24:1: warning: Imported module 'MailResources' is unused
Mail/Views/Thread List/ThreadListView.swift:60:10: warning: Parameter 'isCompact' is unused
Mail/Views/Thread List/ThreadListViewModel.swift:129:17: warning: Property 'loadNextPageThreshold' is unused
Mail/Views/Thread/Message/Attachment/AttachmentCell.swift:21:1: warning: Imported module 'MailResources' is unused
Mail/Views/Thread/Message/Attachment/AttachmentsView.swift:30:24: warning: Property 'showDocumentPicker' is unused
Mail/Views/Thread/Message/Calendar/CalendarAttendeeAvatarView.swift:29:17: warning: Property 'hasChoice' is unused
Mail/Views/Thread/Message/MessageBodyView.swift:32:24: warning: Property 'textPlainHeight' is unused
Mail/Views/Thread/Message/MessageBodyView.swift:36:9: warning: Property 'isMessagePreprocessed' is assigned, but never used
Mail/Views/Thread/Message/MessageBodyView.swift:39:18: warning: Property 'displayContentBlockedActionView' is assigned, but never used
Mail/Views/Thread/Message/MessageHeader/MessageHeaderSummaryView.swift:140:8: warning: Struct 'MessageHeaderSummaryView_Previews' is unused
Mail/Views/Thread/Message/MessageHeader/MessageHeaderView.swift:24:1: warning: Imported module 'MailResources' is unused
Mail/Views/Thread/Message/MessageView+Preprocessing.swift:32:24: warning: Property 'bodySizeThreshold' is unused
Mail/Views/Thread/Message/MessageView.swift:158:8: warning: Struct 'MessageView_Previews' is unused
Mail/Views/Thread/MessageListView.swift:21:1: warning: Imported module 'MailResources' is unused
Mail/Views/Thread/OpenThreadIntentView.swift:41:13: warning: Property 'threadObservation' is assigned, but never used
Mail/Views/ThreadListManagerView.swift:22:1: warning: Imported module 'MailResources' is unused
Mail/Views/Unavailable Mailbox/LockedMailboxView.swift:27:9: warning: Property 'lockedMailbox' is assigned, but never used
MailAppIntentsExtension/AccountEntity.swift:22:1: warning: Imported module 'MailCore' is unused
MailAppIntentsExtension/MailAppIntentsExtension.swift:24:17: warning: Property 'dependencyInjectionHook' is unused
MailAppIntentsExtension/MailAppIntentsTargetAssembly.swift:22:7: warning: Class 'MailAppIntentsTargetAssembly' is unused
MailAppIntentsExtension/MailSetFocusFilterIntent.swift:21:1: warning: Imported module 'MailCore' is unused
MailAppIntentsExtension/MailSetFocusFilterIntent.swift:28:16: warning: Property 'description' is unused
MailCore/API/MailApiFetcher/MailApiFetcher+AI.swift:25:18: warning: Function 'authenticatedAIRequest(_:method:parameters:)' is unused
MailCore/API/MailError.swift:98:9: warning: Property 'httpStatus' is assigned, but never used
MailCore/Cache/AccountManager/AccountManager.swift:27:1: warning: Imported module 'MailResources' is unused
MailCore/Cache/DraftContentManager.swift:98:58: warning: Parameter 'replyMode' is unused
MailCore/Cache/DraftContentManager.swift:272:68: warning: Parameter 'withBR' is unused
MailCore/Cache/DraftManager.swift:29:8: warning: Struct 'DraftQueueElement' is unused
MailCore/Cache/DraftManager.swift:45:10: warning: Function 'saveTask(task:for:)' is unused
MailCore/Cache/DraftManager.swift:70:24: warning: Property 'saveExpirationSec' is unused
MailCore/Cache/MailboxManager/MailboxManager+Message.swift:22:1: warning: Imported module 'MailResources' is unused
MailCore/Cache/MailboxManager/MailboxManager+Signatures.swift:20:1: warning: Imported module 'MailResources' is unused
MailCore/Cache/MailboxManager/MailboxManager.swift:28:28: warning: Property 'snackbarPresenter' is unused
MailCore/Models/AI/AIMessage.swift:30:9: warning: Property 'recipient' is assigned, but never used
MailCore/Models/Contact/CommonContact.swift:36:17: warning: Function 'from(contactConfiguration:)' is unused
MailCore/Models/Draft.swift:20:1: warning: Imported module 'MailResources' is unused
MailCore/Models/Draft.swift:185:29: warning: Parameter 'isOffline' is unused
MailCore/Models/Message.swift:413:9: warning: Parameter 'safeDisplay' is unused
MailCore/Models/Recipient.swift:21:1: warning: Imported module 'MailResources' is unused
MailCore/Models/Request Body/NewContact.swift:23:13: warning: Property 'value' is assigned, but never used
MailCore/Models/Request Body/NewContact.swift:24:13: warning: Property 'type' is unused
MailCore/Models/Request Body/NewContact.swift:27:9: warning: Property 'firstname' is assigned, but never used
MailCore/Models/Request Body/NewContact.swift:28:9: warning: Property 'lastname' is assigned, but never used
MailCore/Models/Request Body/NewContact.swift:29:9: warning: Property 'emails' is assigned, but never used
MailCore/Models/Request Body/NewContact.swift:30:9: warning: Property 'addressbookId' is assigned, but never used
MailCore/Models/Request Body/NewFolder.swift:22:9: warning: Property 'name' is assigned, but never used
MailCore/Models/Request Body/NewFolder.swift:23:9: warning: Property 'path' is assigned, but never used
MailCore/Utils/DisplayablePersonFormatter.swift:20:1: warning: Imported module 'MailResources' is unused
MailCore/Utils/IdentifiableURLs.swift:30:8: warning: Struct 'IdentifiableURLComponents' is unused
MailCore/Utils/MessageBodyUtils.swift:25:24: warning: Property 'blockquote' is unused
MailCore/Utils/MessageBodyUtils.swift:125:25: warning: Function 'splitBodyAndQuote(blockquoteElement:htmlDocumentWithQuote:currentQuoteDescriptor:)' is unused
MailCore/Utils/SnackBar/IKSnackBar+Extension.swift:60:9: warning: Parameter 'anchor' is unused
MailNotificationServiceExtension/NotificationService.swift:31:17: warning: Property 'dependencyInjectionHook' is unused
MailNotificationServiceExtension/NotificationServiceAssembly.swift:27:7: warning: Class 'NotificationServiceTargetAssembly' is unused
MailShareExtension/MailShareExtensionTargetAssembly.swift:21:1: warning: Imported module 'MailCore' is unused
MailShareExtension/MailShareExtensionTargetAssembly.swift:23:7: warning: Class 'MailShareExtensionTargetAssembly' is unused
MailShareExtension/Proxy/MessageActionHandler.swift:26:58: warning: Parameter 'mailbox' is unused
MailShareExtension/Proxy/MessageActionHandler.swift:28:57: warning: Parameter 'mailbox' is unused
MailShareExtension/Proxy/URLOpener.swift:24:9: warning: Property 'extensionContext' is assigned, but never used
MailShareExtension/ShareViewController.swift:29:17: warning: Property 'dependencyInjectionHook' is unused

@Infomaniak Infomaniak deleted a comment from github-actions bot Apr 29, 2024
@PhilippeWeidmann PhilippeWeidmann force-pushed the periphery branch 9 times, most recently from 91632d0 to 527ce14 Compare April 29, 2024 07:53
@PhilippeWeidmann PhilippeWeidmann marked this pull request as ready for review April 29, 2024 11:04
Copy link
Contributor

@adrien-coye adrien-coye left a comment

Choose a reason for hiding this comment

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

Looks good to me. Checkout my comment about defining an extra variable, you can either change it or merge this as is. As you prefer.

scripts/periphery.sh Show resolved Hide resolved
scripts/periphery.sh Outdated Show resolved Hide resolved
Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@PhilippeWeidmann PhilippeWeidmann merged commit 3aba2ba into master Apr 30, 2024
7 checks passed
@PhilippeWeidmann PhilippeWeidmann deleted the periphery branch April 30, 2024 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants