Skip to content

Delete unsafe UseEnumsForNamespacing rule #146

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 1 commit into from
Feb 12, 2020

Conversation

dylansturg
Copy link
Contributor

While using enums for namespaces is a superior coding practice, this rule lacks sufficient context to safely perform this transformation. It's possible to use extensions in the same file or a different file to add a conformance to a struct which makes it ineligible to become an enum. Unfortunately, the SyntaxVisitor is only able to look at nodes in the AST for a single file and that is too narrow of a scope to verify that the struct can safely be an enum.

Even as a lint rule, this would raise false positives and those false positives cannot be removed. It's best not to convert to a lint rule for that reason.

While using enums for namespaces is a superior coding practice, this rule lacks sufficient context to safely perform this transformation. It's possible to use extensions in the same file or a different file to add a conformance to a struct which makes it ineligible to become an enum. Unfortunately, the SyntaxVisitor is only able to look at nodes in the AST for a single file and that is too narrow of a scope to verify that the struct can safely be an enum.

Even as a lint rule, this would raise false positives and those false positives cannot be removed. It's best not to convert to a lint rule for that reason.
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.

😢

@allevato allevato merged commit d2e3fa2 into swiftlang:master Feb 12, 2020
@dylansturg dylansturg deleted the delete_unsafe_transform branch February 12, 2020 20:33
aaditya-chandrasekhar pushed a commit to val-verde/swift-format that referenced this pull request May 20, 2021
…wiftlang#146)

* FIX: swift-doc creates file and directory with unexpected permission

**Problem**

swift-doc creates file with execution bit, also creates directory
without execution bit.

**Solution**

Remove unexpected permission attributes given to the `FileManager`
and let them to use file system defaults.

* Update changelog.
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