-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
explicit_acl and explicit_top_level_acl conflict with no_extension_access_modifier #2694
Comments
I started getting this after upgrading to Xcode 10.2 today. Fun fact: even after downgrading to Xcode 10.1 (including removing and re-installing the Xcode CLI tools), the issue still persists. What could be causing this? |
Seems like we might want to ignore extensions in |
And // compiles but violates
internal extension Foo {
func bar()
} // compiles but violates
extension Foo {
internal func bar()
} // compiles but violates
extension Foo {
func bar()
} // doesn't violate but doesn't compile either
internal extension Foo {
internal func bar()
} |
Let's see if #2720 fixes this issue. |
@svenmuennich |
Fixed in #2720 by @marcelofabri |
Thank you guys! |
Sorry to comment on a closed issue but the top example from @akashivskyy doesn't seem to work in 0.32.0/Swift 5, is this expected? |
What do you mean @Noobish1?
|
@jpsim I meant the full example including the function, though this might be a totally separate issue I have If I try to write this: internal extension String {
internal func someFunc() {}
} It doesn't compile in Xcode and gives me an error stating:
If I then use the fix it and remove the internal extension String {
func someFunc() {}
} which violates
I'm using Swift 5.0.1 in Xcode 10.2.1 |
How about this? extension String {
internal func someFunc() {}
} |
ha that does actually work, I guess it only checks when you explicitly declare the ACL for the extension? I guess that'll do the job, thanks @jpsim, sorry again for commenting on a closed issue. |
I think the first case (
If one of the answers is |
Both answers are yes. SwiftLint has always assumed that it was running on code that compiles. The alternative would make SwiftLint as complex as the compiler itself. The explicit ACL rule is an opt-in rule where developers want to make their declarations have an explicit ACL keyword. An extension scope is not a declaration in and of itself. I can’t reference your extension when writing code against your module. Function declarations are declarations. I hope that helps clarify things. Can we please open new tickets moving forward if we have follow up discussions? Commenting on closed tickets makes it way more likely to 1) miss important information that is suggested by the new issue template and 2) lead to a maintainer not answering right away and forgetting that a thread was started in a closed ticket. Thanks! |
New Issue Checklist
Describe the bug
In Xcode 10.2 these rules conflict, whereas previous they didn't (although I'm not sure why). It is now not possible to satisfy both of them (which makes sense).
I think the easiest solution would be to add configuration options to explicit_acl and explicit_top_level_acl to exclude extensions?
Complete output when running SwiftLint, including the stack trace and command used
Environment
swiftlint version
to be sure)?0.31.0
Homebrew
No
xcode-select -p
)?10.2
echo "[string here]" | swiftlint lint --no-cache --use-stdin --enable-all-rules
to quickly test if your example is really demonstrating the issue. If your example is more
complex, you can use
swiftlint lint --path [file here] --no-cache --enable-all-rules
.The text was updated successfully, but these errors were encountered: