Skip to content

Add Periphery unused code workflow - #180

Closed
ileitch wants to merge 1 commit into
rsyncOSX:mainfrom
ileitch:periphery/unused-code
Closed

Add Periphery unused code workflow#180
ileitch wants to merge 1 commit into
rsyncOSX:mainfrom
ileitch:periphery/unused-code

Conversation

@ileitch

@ileitch ileitch commented Aug 19, 2026

Copy link
Copy Markdown

Any interest in detecting unused code in PRs?

This change integrates the Periphery reusable workflow. On pushes to the main branch, it scans for unused code and records a baseline. On PRs, it pulls the baseline for the merge-base commit and then reports any code that’s newly identified as unused.

The results are reported as inline comments in the diff for newly introduced unused code, and also a PR comment which also includes any results that aren’t present in the diff (i.e the change removes the final references to some existing code).

There aren’t any results posted in this PR, because main doesn’t have a baseline yet, and the run_without_baseline option is disabled (there are too many results), so it’ll take some time before folks base their PRs on main and start affecting the code graph.

@rsyncOSX

Copy link
Copy Markdown
Owner

There was an issue with the PR, but I am normally using periphery by command line. There is also a .periphery.yml on root of project which should be loaded I think? There are several unused properties now, I will clean it in some days, have been busy with some other projects now..

~/GitHub/RsyncUI/RsyncUI on  version-3.0.4
❯ periphery scan

  • Inspecting project...
  • Building RsyncUI...
  • Indexing...
  • Analyzing...

/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Execution/EstimateExecute/Estimate.swift:22:9: warning: Unused property 'synchronizeIDwitherror'
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Execution/EstimateExecute/Estimate.swift:26:17: warning: Assign-only property 'activeStreamingProcess' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Execution/EstimateExecute/Execute.swift:34:17: warning: Assign-only property 'activeStreamingProcess' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Global/AlertError.swift:33:5: warning: Unused initializer 'init(localizedError:)'
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Global/AlertError.swift:37:5: warning: Unused initializer 'init(nsError:)'
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Loggdata/LogChartService.swift:13:9: warning: Assign-only property 'seconds' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Snapshots/LogRecordSnapshot.swift:15:9: warning: Assign-only property 'date' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Snapshots/SnapshotRemoteCatalogs.swift:19:17: warning: Assign-only property 'activeStreamingProcess' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Snapshots/Snapshotlogsandcatalogs.swift:19:17: warning: Assign-only property 'activeStreamingProcess' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Basic/VerifyObservableAddConfiguration.swift:13:8: warning: Unused struct 'VerifyObservableAddConfiguration'
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:52:9: warning: Assign-only property 'rsyncversion3' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:53:9: warning: Assign-only property 'addsummarylogrecord' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:54:9: warning: Assign-only property 'localrsyncpath' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:55:9: warning: Assign-only property 'pathforrestore' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:56:9: warning: Assign-only property 'marknumberofdayssince' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:57:9: warning: Assign-only property 'sshkeypathandidentityfile' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:58:9: warning: Assign-only property 'sshport' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:59:9: warning: Assign-only property 'environment' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:60:9: warning: Assign-only property 'environmentvalue' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:61:9: warning: Assign-only property 'checkforerrorinrsyncoutput' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:62:9: warning: Assign-only property 'confirmexecute' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:63:9: warning: Assign-only property 'synchronizewithouttimedelay' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:64:9: warning: Assign-only property 'sidebarishidden' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:65:9: warning: Assign-only property 'observemountedvolumes' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:66:9: warning: Assign-only property 'alwaysshowestimateddetailsview' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:67:9: warning: Assign-only property 'silencemissingstats' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:68:9: warning: Assign-only property 'validatearguments' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Widgets/WriteWidgetsURLStringsJSON.swift:48:9: warning: Assign-only property 'urlstringestimate' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Utils/extensions.swift:44:9: warning: Unused property 'isnexttwomonths'
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Views/Detailsview/SummarizedDetailsView.swift:17:24: warning: Unused property 'isPresentingConfirm'
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Views/InspectorViews/Add/extensionAddTaskView+BusinessLogic.swift:92:9: warning: Unused property 'ddisableadd'
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Views/InspectorViews/Add/extensionAddTaskView.swift:51:9: warning: Unused property 'saveURLSection'
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Views/InspectorViews/EditTabView.swift:14:24: warning: Unused property 'isInspectorPresented'
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Views/InspectorViews/InspectorView.swift:21:24: warning: Unused property 'selectedTab'
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Views/InspectorViews/LogRecords/LogRecordsTabView.swift:91:9: warning: Unused property 'configurations'
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Views/Modifiers/Viewmodifiers.swift:11:8: warning: Unused struct 'FixedTag'
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Views/Restore/RestoreTableView.swift:14:24: warning: Unused property 'selecteduuids'
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Views/ScheduleView/CalendarMonthView.swift:31:24: warning: Unused property 'dateAdded'
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Views/ScheduleView/CalendarMonthView.swift:32:24: warning: Unused property 'dateRun'
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Views/Snapshots/SnapshotsView.swift:24:24: warning: Unused property 'deleteiscompleted'
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Views/Tasks/ExecuteEstTasksView.swift:19:24: warning: Unused property 'doubleclick'
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Views/Tasks/LogStatsChartView.swift:284:9: warning: Assign-only property 'id' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Views/Tasks/LogStatsChartView.swift:285:9: warning: Assign-only property 'hiddenID' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Views/Tasks/LogStatsChartView.swift:289:9: warning: Assign-only property 'profile' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Views/Tasks/LogStatsChartView.swift:290:9: warning: Assign-only property 'selectedConfigurationID' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Views/Tasks/LogStatsChartView.swift:291:9: warning: Assign-only property 'metric' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Views/Tasks/LogStatsChartView.swift:292:9: warning: Assign-only property 'limit' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Views/Tasks/LogStatsChartView.swift:293:9: warning: Assign-only property 'configurations' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUITests/SharedJSONStorageTests.swift:58:9: warning: Assign-only property 'id' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUITests/SharedJSONStorageTests.swift:59:9: warning: Assign-only property 'name' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/WidgetEstimate/SharedJSONStorageReader.swift:26:10: warning: Unused function 'decodeArray(_:from:)'

@rsyncOSX

Copy link
Copy Markdown
Owner

There is also an issue about periphery - reporting a false issue.
Screenshot 2026-08-20 at 06 48 16

@rsyncOSX rsyncOSX closed this Aug 20, 2026
@ileitch

ileitch commented Aug 20, 2026

Copy link
Copy Markdown
Author

@rsyncOSX Which version of periphery are you using? Can you also give me some more details about the false positive? Are you suggesting that Periphery reported StoredUserConfiguration as unused?

@rsyncOSX

Copy link
Copy Markdown
Owner

I um using the latest version 3.8.0. Her is a run today, as you see periphery is reporting the lines 52 - 68 as unused. (sorry for the long lines)
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:52:9: warning: Assign-only property 'rsyncversion3' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:53:9: warning: Assign-only property 'addsummarylogrecord' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:54:9: warning: Assign-only property 'localrsyncpath' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:55:9: warning: Assign-only property 'pathforrestore' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:56:9: warning: Assign-only property 'marknumberofdayssince' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:57:9: warning: Assign-only property 'sshkeypathandidentityfile' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:58:9: warning: Assign-only property 'sshport' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:59:9: warning: Assign-only property 'environment' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:60:9: warning: Assign-only property 'environmentvalue' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:61:9: warning: Assign-only property 'checkforerrorinrsyncoutput' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:62:9: warning: Assign-only property 'confirmexecute' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:63:9: warning: Assign-only property 'synchronizewithouttimedelay' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:64:9: warning: Assign-only property 'sidebarishidden' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:65:9: warning: Assign-only property 'observemountedvolumes' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:66:9: warning: Assign-only property 'alwaysshowestimateddetailsview' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:67:9: warning: Assign-only property 'silencemissingstats' is assigned, but never used
/Users/thomas/GitHub/RsyncUI/RsyncUI/RsyncUI/Model/Storage/Userconfiguration/WriteUserConfigurationJSON.swift:68:9: warning: Assign-only property 'validatearguments' is assigned, but never used

@ileitch

ileitch commented Aug 21, 2026

Copy link
Copy Markdown
Author

It's saying the properties were assigned a value (via the synthesized initializer) but it can't see that the properties are read, because that happens within Codable. So removing the whole struct wasn't the correct interpretation of these results. You can instead resolve this by using the --retain-codable-properties option, or by adding a // periphery:ignore comment above the StoredUserConfiguration struct.

@rsyncOSX

Copy link
Copy Markdown
Owner

Hmm, tried adding retain-codable-properties to the .periphery.yml file

project: RsyncUI.xcodeproj
retain_objc_accessible: true
retain_public: true
retain-codable-properties: true
schemes:
- RsyncUI
index_exclude:
- RsyncUI/Model/Utils/yudpsocket/ytcpsocket.swift

Also tried the ignore in the heading of the enum, still periphery reports like WriteUserConfigurationJSON.swift:52:9: warning: Assign-only property 'rsyncversion3' is assigned, but never used

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.

2 participants