jpsim / SourceKitten

An adorable little framework and command line tool for interacting with SourceKit.
MIT License
2.31k stars 226 forks source link

sourcekitten is crashing on my Swift project #14

Closed ndbroadbent closed 9 years ago

ndbroadbent commented 9 years ago

I opened an issue on Jazzy before realizing that the stack trace points to sourcekitten.

Here's the crash log: https://gist.github.com/ndbroadbent/112350ea5f4cebc6b84e

Thanks!

jpsim commented 9 years ago

Looks like Spot.swift, Comment.swift and User.swift are all failing. Could you post the contents of those files here?

jpsim commented 9 years ago

I've pushed a fix to sourcekitten 1aa5f28ebc1d2d6efc344732d33b70b190156438, hopefully). I'd love to know if this allows docs to be built for your project (despite skipping Spot.swift, Comment.swift & User.swift).

You can install sourcekitten from master by running ./install.sh. Then run sourcekitten > MyProject.jazzy.json in the root of your project. Then you can run jazzy -s MyProject.jazzy.json to use that output.

ndbroadbent commented 9 years ago

Hey, thanks for your help so far! I tried out 1aa5f28, but I'm still getting a crash. Here's the new crash logs: https://gist.github.com/ndbroadbent/527839925d5384c6bebc

Here's the source for Spot.swift, Comment.swift & User.swift: https://gist.github.com/ndbroadbent/3cce33c971f9340afda6

jpsim commented 9 years ago

@ndbroadbent I made a stupid mistake, printing an optional before unwrapping it. I just pushed jazzy 0.0.18 to rubygems, which should skip files that sourcekitten can't parse correctly, so your docs should build if you use that version.

I'll investigate why Spot.swift, Comment.swift & User.swift don't parse. At first, I thought they were failing because they all use @NSManaged, but other files using that are correctly parsed (see https://gist.github.com/ndbroadbent/112350ea5f4cebc6b84e#file-jazzy_crash-log-L8762-L8785).

ndbroadbent commented 9 years ago

Sorry, I don't think it is fixed yet. It might be easier if I add your username to our GitHub organization so you can check out the repo and reproduce. Please feel free to accept the invite and checkout https://github.com/hdwr/hdwr-ios

jpsim commented 9 years ago

Thanks for the access, @ndbroadbent! Your project proved very useful in making sourcekitten/jazzy safer since it has a lot of code, yet no documentation comments, so it hit a lot of previously untested code.

Your project is properly parsed as of sourcekitten 0.2.5 and jazzy master (not pushed to rubygems yet), but as I mentioned, yields mostly empty docs since there are no documentation comments.

To add docs to your project, I'd recommend you read http://nshipster.com/swift-documentation/ to learn more about Swift's documentation comment format.

jpsim commented 9 years ago

@ndbroadbent and I just fixed the crash causing Spot.swift, Comment.swift & User.swift to not parse (see 79744a1e9176c014c1068a6e43d105779fb4dcf9). So I'm closing this issue :smile:.

Thank you very much for your help in improving jazzy/sourcekitten!

PS: I just left the HDWR GitHub org.

ndbroadbent commented 9 years ago

@jpsim thanks very much for fixing! Hehe sorry my project didn't have any documentation yet, that must have been a curveball. About to go through and add a bunch of docs now that jazzy is up and running :)

Thanks again, and Merry Christmas!