[help wanted] The map lists a Swift `@main` type as a program entry (CONTRIBUTING slice 10b)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 53/100
Research direction
Start with queries/swift/tags.scm and use ripwire --match on the provided fixture to confirm the Swift grammar nodes for @main. Read rustItemAttrRunAny in src/ingest_names.h and trace the inventory styles, predicates, and legend in src/mapinventory.h. Add the entry fact through an existing channel, define the attribute-marked type as the entry, and update test/mapinventorycheck.sh while retaining its unannotated App.main near miss. Done means the Swift positive control emits an entry with run among its callee rows and the stated acceptance gates pass.
Written by the indexing model from the issue text.
Description
Claim it in this issue first. Size: S. Depends on: nothing. Language: Swift.
The problem, in user terms
The map's inventory names the program entries among the files it does not show, so an agent landing in a repository sees where execution starts. For C, C++, Rust, Go, Java, Python and the others it does; for a Swift package whose entry is an attribute (@main struct Tool { static func main() { … } }) it does not. Fixture: Sources/Tool.swift with that type, Sources/Util.swift defining helper(), and G1.swift to G6.swift each calling helper() (so the shown row is helper, not the entry), against the same shape in C (main.c with int main(void)):
ripwire . --no-cache --top-k=1 # the Swift package
<inv listed="1" unlisted="7">
<ls p="Sources" n="7" f="G1.swift,…,Tool.swift"/> (no <entry> row)
ripwire . --no-cache --top-k=1 # the C project
<entry p="main.c" n="main" …>
(built from daf1ccba.) inventoryEntryStyle (src/mapinventory.h) has no Swift row, so Swift is style None: "no claim". The legend and the file header both say why: "entries declared … by an attribute (Swift @main) are not detected" because the index does not read an attribute as an entry declaration. (Swift's other entry, a top-level main.swift, is a different convention and not this slice.)
Files to touch
queries/swift/tags.scm: the@mainattribute is on the type declaration (class_declaration, whose modifiers hold anattribute). Find the node shape withripwire --matchon your fixture before writing the pattern (the grammar's attribute and modifier node names are the part to verify, not guess). Capture the attribute so ingest records an entry-declaration fact on the type; follow how Rust reads an item attribute (rustItemAttrRunAny,src/ingest_names.h) or how a test attribute is read, so the fact rides an existing channel rather than a new walk.src/mapinventory.h:inventoryEntryStyle/isInventoryEntryShape/kInventory*Langs: a fourth style for "an attribute marks the entry type": the type (class or struct) carrying the fact is the entry,mainis its callee. Keep it a row of data (aLangin a list plus a style), not aLang::Swiftcompare.src/mapinventory.hlegend (kMapInventoryLegend) and the header comment: drop "Swift @main" from the not-detected list; regenerate docs if a generated legend changes.test/mapinventorycheck.sh: arm (Q) currently assertslib/App.swift(a class with a method namedmain, no attribute) is NOT an entry; keep that as the near miss and add the@mainpositive control.
Red-first fixture and gate arm
- red on
main: the Swift fixture prints no<entry>; after the change<entry p="Sources/Tool.swift" n="Tool" …>(orn="main", say which in the PR) withrunamong its callee rows. - near misses:
class App { func main() {} }with no attribute (the existing arm: stays no entry);@mainon anextension;@mainin a test directory (the inventory already excludes test paths); two@maintypes in two targets; a type whosemainis not static.
Acceptance
bash test/langidentitycheck.sh BASE HEAD --langs=swift,kt,java,cs,rs,go,cpp: other languages SAME; Swift DIFFs only on the map's<inv>block, waived by an--intendedrow namingtest/mapinventorycheck.sh. Add one real Swift repository with--repo=swift:<your clone>.ripwire . --quality-delta=origin/main..HEADgates 0; CONTRIBUTING definition of done. The same attribute mechanism is what Kotlin@JvmStaticwould use later; do not add it here.
Not in scope
Kotlin @JvmStatic, manifest-declared entries (Package.swift executable targets, and slice 10a for Cargo and package.json), and Swift main.swift top-level code.
If nobody has claimed this by the time our next integration train starts, we will pick it up ourselves. Claiming it only takes a comment here.
- Dominant language
- C++
- Stars
- 2.5k
- Forks
- 158
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 61
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from redhat-et/ripwire
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 Under an hour Newbie friendliness 78/100
redhat-et/ripwire#334 · 7 comments ·
Maintainers usually reply within 1 day
-
help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
redhat-et/ripwire#68 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Python: four measured import-resolution gaps (repro on pypa/pip)Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 3/5 1-2 days Newbie friendliness 55/100
redhat-et/ripwire#478 · 4 comments ·
Maintainers usually reply within 1 day
All issues in redhat-et/ripwire
Similar issues
-
agent:WSL bug LOW security
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
mgradwohl/tasksmack#3290 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
mw00/project-maya#743 ·
Maintainers usually reply within 1 day
-
Bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
bug triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
envoyproxy/envoy#48897 ·
Maintainers usually reply within 1 day
-
comp-view potential bug
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
ClickHouse/ClickHouse#128410 ·
Maintainers usually reply within 1 day