Skip to content

Add lint warning for retroactive conformances #765

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

Merged
merged 2 commits into from
Jul 12, 2024

Conversation

harlanhaskins
Copy link
Contributor

This provides a lint rule whenever an @retroactive appears in a source file.

I've marked the rule as opt-out, but I'm also wondering if we have a syntax for opting out of a rule in general.

This provides a lint rule whenever an `@retroactive` appears in a source file.

I've marked the rule as opt-out, but I'm also wondering if we have a syntax for opting out of a rule in general.
@harlanhaskins harlanhaskins changed the title Add swift-format rule warning for retroactive conformances. Add lint warning for retroactive conformances Jul 9, 2024
@harlanhaskins
Copy link
Contributor Author

@swift-ci please test

@allevato
Copy link
Member

I've marked the rule as opt-out, but I'm also wondering if we have a syntax for opting out of a rule in general.

You can override the isOptIn property from Rule if you want to make the rule disabled by default, and when you run generate-swift-format it will use flip the default in the generated configuration. Is that what you had in mind?

@harlanhaskins
Copy link
Contributor Author

Oh, I meant like a comment-like syntax for clients to silence the rule within a file, like

// swift-format ignore: AvoidRetroactiveConformances

did we ever get anything like that?

@allevato
Copy link
Member

Yeah, // swift-format-ignore: <rulle name> should work for any visitor-based rule. https://github.com/swiftlang/swift-format/blob/main/Documentation/IgnoringSource.md#ignoring-source-transforming-rules

@allevato
Copy link
Member

Can you please update the CMake files to include the new AvoidRetroactiveConformances.swift file? (Just the Sources, The Tests don't need it.)

Copy link
Member

@allevato allevato left a comment

Choose a reason for hiding this comment

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

Thanks!

@allevato allevato merged commit f42d4f2 into swiftlang:main Jul 12, 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.

2 participants