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

Muting SourceKit warnings on Linux #689

Open
vinivendra opened this issue Dec 30, 2020 · 2 comments
Open

Muting SourceKit warnings on Linux #689

vinivendra opened this issue Dec 30, 2020 · 2 comments

Comments

@vinivendra
Copy link

(Sorry if this isn't the best place for this!)

I'm using SourceKittenFramework to do an indexing request on a Swift file. When that file has warnings, the SourceKit request prints those warnings to the console, and my program's output gets confusing. This happens on Ubuntu, but not on macOS.

Is there a way to use SourceKitten to mute those warnings? Is it something that has to be fixed on SourceKit itself?

@jpsim
Copy link
Owner

jpsim commented Dec 31, 2020

This should be the place for this kind of issue, but I don't know what warnings you're referring to, so I can't help you right now. Can you share more about what's happening? Ideally with steps to reproduce that I can follow on both macOS and Linux to identify the difference?

@vinivendra
Copy link
Author

Sure, no problem. Here's a gist with some files that should help explain the issue.

Basically, I created a short test.swift file (in the gist). When I compile it with Swift, it raises this warning, as expected:

test.swift:2:6: warning: initialization of variable 'x' was never used; consider replacing with assignment to '_' or removing it
        var x = 0
        ~~~~^
        _

Then, I created a new Swift package using swift package init --name Example --type executable. I added SourceKitten to the Package.swift file (also in the gist).

Finally, I added some code to the package's main.swift file (also in the gist) so that it'll use SourceKitten to execute an indexing request on the test.swift file.

When I run this on macOS BigSur using swift run it compiles and runs normally, and nothing gets printed to the console.

However, when I run this on Linux (on a Docker container using this Dockerfile) with swift run, it prints the above warning to the console. Ideally, I'd like the program to not print this warning.

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

No branches or pull requests

2 participants