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

Add a baseline capability to Periphery #733

Closed

Conversation

mildm8nnered
Copy link
Contributor

@mildm8nnered mildm8nnered commented May 12, 2024

WIP.

Addresses #710

This is the equivalent of realm/SwiftLint#5475

This adds two new arguments for the scan command: --write-baseline <baseline> to write a baseline file, and --baseline <baseline> to specify a baseline to use while scanning,

Should be functional, but periphery does not give consistent results for me since 2.18.0, which is problematic - see #731

Straight port from the SwiftLint version - style is considerably different to typical periphery code style
Currently no unit tests
No way to view or compare baselines (potentially a nice to have).

@mildm8nnered mildm8nnered changed the title Mildm8nnered baseline Add a baseline capability to Periphery May 12, 2024
@aiKrice
Copy link

aiKrice commented May 16, 2024

@mildm8nnered How could I help you to test ? Please provide a how to in the PR description. I would like to help you. I followed you on Swiftlint already :D

@mildm8nnered
Copy link
Contributor Author

@mildm8nnered How could I help you to test ? Please provide a how to in the PR description. I would like to help you. I followed you on Swiftlint already :D

Hi @aiKrice - I'll add some instructions shortly. Would love to get some feedback.

@mildm8nnered
Copy link
Contributor Author

@mildm8nnered How could I help you to test ? Please provide a how to in the PR description. I would like to help you. I followed you on Swiftlint already :D

Hi @aiKrice - I'll add some instructions shortly. Would love to get some feedback.

I've updated the description above ...

@ileitch
Copy link
Contributor

ileitch commented May 19, 2024

Thanks for working on this @mildm8nnered. Have you considered only saving the USR in the baseline? The baseline would still behave the same after some code movement while being much simpler to implement.

@mildm8nnered
Copy link
Contributor Author

Thanks for working on this @mildm8nnered. Have you considered only saving the USR in the baseline? The baseline would still behave the same after some code movement while being much simpler to implement.

Hi @ileitch - I have not really played with it that much, as I was focussed on getting the SwiftLint version over the line.

If there a way to store less, that would be great. I'm travelling right now, but will be back home later this week, so will pick this back up again then.

@mildm8nnered
Copy link
Contributor Author

So #731 is resolved for me, and I fixed some issues where I was incorrectly storing the hash values.

I'm still seeing some weirdness and inconsistency in the baseline output, but it looks like something else - violations look almost like they should match between runs, but the path storage and locations are different. Not sure if the problem is in the new code or not, but I'll dig into it.

@ileitch
Copy link
Contributor

ileitch commented Jun 2, 2024

@mildm8nnered The complexity of this approach makes me nervous, and I'm worried we might miss some edge cases, or regress easily. I think the USR alone should be enough, at least to begin with. Here's a comparative impletion that just records the USRs: #751

@ileitch
Copy link
Contributor

ileitch commented Jun 9, 2024

Implememted in #751. Thanks for guiding this effort, @mildm8nnered!

@ileitch ileitch closed this Jun 9, 2024
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