periphery icon indicating copy to clipboard operation
periphery copied to clipboard

False results for Codable after 2.18.0 update

Open AllDmeat opened this issue 2 years ago • 1 comments

After updating Periphery to 2.18.0, properties in our Codable and Encodable structures started being marked as unused. This issue was not present in version 2.17.1.

Affected structures are used with JSONEncoder. There is a section Encodable in the README.md, and it states "This property retention behavior is automatic". That was indeed the case before version 2.18.0, but now it is not so.

It might be related to the fact that in version 2.18.0, the --external-encodable-protocols flag has been deprecated, and instead, we are now supposed to use --external-codable-protocols.

Is this a bug or an intentionally updated behavior? If it's the latter, then the README.md should also be updated accordingly.

AllDmeat avatar Jan 22 '24 07:01 AllDmeat

I have a smiller problem. When using the external-codable-protocols option, the following error is output.

.periphery.yml: invalid key 'external-codable-protocols'

tihimsm avatar Feb 12 '24 11:02 tihimsm

Run it with the --retain-codable-properties option.

 periphery scan --retain-codable-properties

I ran into the same issue and did some digging running through the debugger and found that. It does mention it in the CHANGELOG.md, but not in the README.md.

paynerc-socure avatar Mar 13 '24 16:03 paynerc-socure

Sorry for not updating the README and causing confusion. This was indeed an intentional change and --retain-codable-properties can be used to retain all Codable properties.

.periphery.yml: invalid key 'external-codable-protocols'

Configuration options use snake case in the yml, so external_codable_protocols.

ileitch avatar May 19 '24 16:05 ileitch