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

Exclude public option #34

Closed
wants to merge 1 commit into from
Closed

Exclude public option #34

wants to merge 1 commit into from

Conversation

vrujbr
Copy link

@vrujbr vrujbr commented Nov 12, 2018

Hey, this PR adds support for a new flag -exclude-public.
It is a minimal thing. It doesn't support other access flags like internal, but it shows the way and gets the job I need done.
Btw the way you get sourcekitd stuff is quite unswifty, check out this code from Apple guys: https://github.com/apple/swift/blob/master/tools/SourceKit/tools/swift-lang/SourceKitdResponse.swift
You might just love it ;-)

@rockbruno
Copy link
Owner

Love the Swift bit! At the time I didn't really understood how SourceKit worked, so I got the API to work by ripping wrappers around the web... Definitely a good time to write our own version of the API!

I've seen you noticed that @hadiidbouk was already investigating this - I think that's a great way to do it but I do think it shares the problem where the methods declared inside public protocols will not be avoided, right?

@@ -108,6 +111,21 @@ extension AutomaticSwiftShield {
guard let name = dict.getString(key: sourceKit.nameID)?.trueName, let usr = dict.getString(key: sourceKit.usrID) else {
return nil
}

if excludePublic {
let attribtuesArray = dict.getDictionaryValue(key: sourceKit.attributesId)
Copy link
Owner

Choose a reason for hiding this comment

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

Nit: Typo on attribtuesArray

@vrujbr
Copy link
Author

vrujbr commented Nov 12, 2018

Yes I guess it should share the problem with protocols. Feel free to ignore this PR and wait for @hadiidbouk to finish his solution :-)

@rockbruno
Copy link
Owner

@hadiidbouk When are you going to push your changes? I think we can work together on this one 🙂

@hadiidbouk
Copy link
Contributor

I will push all the code tonight 👍

@rockbruno
Copy link
Owner

I'll close this because we have 3 PRs for the same feature, so I'm keeping only the original one.
By the way @vrujbr , I refactored the API to use Apple's wrapper and the results were great. Thanks again for showing me it! 🙂

@rockbruno rockbruno closed this Nov 25, 2018
@vrujbr
Copy link
Author

vrujbr commented Nov 26, 2018

Glad to help 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants