jpsim / jpsim/SourceKitten

Using SKitten to create LinuxMain.swift file

Open
#528 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
2.4k
Forks
237
PR merge metrics
No merged PRs in 30d

Description

Would it be possible? I've been trying to make a decent python script to do this, but the lack of semantics makes it fragile: I can't know whether a class inherits from XCTest or know the relationship between two classes in different files. E.g: Foo inherits from Bar, and Bar inherits from XCTest, but in an extension. The combinations are endless, which seriously limits what I can make with just regexes. I'd need to make a compiler to address those issues 😅

Which brings me to SourceKit and therefore, SourceKitten. Could I do something like this:

  • In a directory, get all Swift files and extract the classes that inherit from XCTest from them.
  • Then, for each class, extract the names of all test methods that belong to it.

Just that would suffice. The rest is easy and does not require semantic knowledge (it's just string manipulation from then on).

Could I do this with SourceKitten?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by checking the SourceKit and SourceKitten interfaces for semantic information about Swift inheritance, extensions, and XCTest methods. Done means determining whether those queries are supported and documenting the relevant approach or the limitation; no source files or tests are identified in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.