Good first issue (one language per PR): teach the `tangle` steering-locals walk one more language — Kotlin, Swift, Dart, Lua, GDScript, PHP, Ruby, Bash
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 55/100
Direzione di ricerca
Start with src/ingest_metrics.h functions steer_noteDeclaration, steer_noteWrite, and steer_noteCondition, then inspect SteerDecl and the language row in src/langfacts.h. Mirror the matching fixtures in test/lib/tanglefixtures.py and regression arms in test/tanglecheck.sh; first verify the chosen language’s steerfar case has no steer= on main. Done means the far case reports steer="1", all three near misses omit steer=, and the listed regression, cache, identity, and quality checks pass.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Claim a language in a comment here first, one language per PR. Size: S each. Depends on: nothing. Good for a first contribution: one branch in one function, a fixture generated by a script that already exists, and a twin in a language that already works.
The problem, in user terms
--quality-delta's tangle kind scores a long function by its nesting, its deep share and its steering locals: a primitive local (a flag, a counter) rewritten in one place and then read in a branch condition ten or more statements later, so the reader has to carry it in their head. --metrics prints the count as steer=.
The walk that finds steering locals reads each language's declaration grammar, chosen by LangFacts::steerDecl (src/langfacts.h:141, SteerDecl). Eight shapes exist (C family, Python, JS/TS, Java, C#, Go, Rust). For Swift, Ruby, PHP, Lua, Elixir, Dart, Kotlin, GDScript, Clojure and Bash it is None, so steer is always 0 there and tangle is nesting and deep share only (src/langfacts.h:138-140).
Repro: the same 85-line function in each language (a flag set inside a loop, then tested 12 statements later; the shape of steerfar in test/lib/tanglefixtures.py). On main (e94757295), other attributes cut:
ripwire <dir> --no-cache --metrics --page-bytes=0
java <s t="method" n="steerfar" cx="4" loc="85" nest="2" steer="1" tangle="0.9"
kt <s t="fn" n="steerfar" cx="4" loc="85" nest="2"
swift <s t="fn" n="steerfar" cx="4" loc="85" nest="2"
dart <s t="fn" n="steerfar" cx="4" loc="85" nest="2"
lua <s t="fn" n="steerfar" cx="4" loc="85" nest="2"
gd <s t="fn" n="steerfar" cx="4" loc="81" nest="2"
php <s t="fn" n="steerfar" cx="4" loc="85" nest="2"
rb <s t="method" n="steerfar" cx="4" loc="85" nest="2"
sh <s t="fn" n="steerfar" cx="4" loc="85" nest="2"
Expected after a language's PR: that language prints steer="1" on steerfar, as Java does, and no steer= on the near twin (the flag tested in the next statement, steernear).
Where to look
steer_noteDeclaration,src/ingest_metrics.h:914: oneif( shape == SteerDecl::… )branch per declaration grammar. Copy the closest one.steer_noteWrite,src/ingest_metrics.h:1001: the write shapes (assignment_expression,augmented_assignment_expression, Go'sassignment_statement,update_expression, …).steer_declare(:742),steer_write(:760) andsteer_noteCondition(:1286) accept a name only when its node kind isidentifier. Some grammars spell a name differently (table below).steer_noteConditionreads the branch'sconditionfield, then itsvaluefield. One grammar below has no such field.steer_scopeEndOf(:725): block-scoped languages close a slot at the end of the enclosing block; Python's never close. Pick the right one for your language.SteerDecl(src/langfacts.h:141) and the language's row inkLangFacts(src/langfacts.h:596-648): add the enum value and set.steerDecl.test/tanglecheck.sharms (s1)-(s4) andtest/lib/tanglefixtures.py(steer,steercursor,steerscope): the C++ fixtures to mirror.
The languages
Node names below come from --match on the repro fixture with the main binary. Check them again on yours.
- Kotlin. Declaration:
property_declaration(var/val; onlyvarcan steer). Write:assignment(covers+=). Names aresimple_identifier, notidentifier.if_expressionhas acondition:field. Block-scoped. - Swift. Declaration:
property_declaration(var/let). Write:assignment(covers+=). Names aresimple_identifier.if_statementhascondition:. Block-scoped. - Dart. Declaration:
local_variable_declaration(initialized_variable_definition name:). Write:assignment_expression, already handled. Names areidentifier.if_statementhas nocondition:field: the condition is a plain child, sosteer_noteConditionneeds a fallback. Block-scoped. - Lua. Declaration:
variable_declaration(local x = …, which wraps anassignment_statement). Write:assignment_statementwith avariable_listchild (noleft:field, unlike Go's). Names areidentifier.if_statementhascondition:. Block-scoped. - GDScript. Declaration:
variable_statement(var x = …,name:field). Writes:assignment,augmented_assignment. Names areidentifier.if_statementhascondition:. Indentation blocks arebodynodes: check whatsteer_scopeEndOfsees. - PHP. No declaration statement: the first
assignment_expressionto a$namedeclares it, as in Python. Writes:assignment_expression,augmented_assignment_expression. Names arevariable_name(with anamechild). Function-scoped, like Python. - Ruby. No declaration statement, as in Python. Writes:
assignment,operator_assignment. Names areidentifier.ifhascondition:. Function-scoped for locals (a block's own new locals end with the block: say what you do). - Bash. Declaration:
declaration_command(local x=…). Write:variable_assignment. Names arevariable_name; a read in a test is a$xexpansion inside a command ([ "$x" -eq 1 ]), not a condition field. Larger than the others: start only if you know the Bash grammar. - Not planned: Clojure (
letlocals cannot be rewritten, so the steering shape does not exist; say so in a comment if you disagree) and Elixir (a rebinding inside a branch does not leak out of it). If you have a measured counter-example, open a separate issue.
Suggested approach (per language)
- Write the language's
steerfar/steernearpair (copysteer()intest/lib/tanglefixtures.py: 30 lines, a loop that sets a flag, N filler statements, thenif flag). Showsteerfarwith nosteer=onmain. - Add the
SteerDeclvalue, set it in the language'skLangFactsrow, and add one branch tosteer_noteDeclaration(and tosteer_noteWriteif the write node is new). - If names are not
identifier, teach the three name checks your spelling, gated on the shape, so other languages are byte-identical. - Add the
steercursorandsteerscopenear misses for your language: a cursor read only as a bound or an index does not steer, and a local whose block closed does not steer.
The test to add (red first)
A language section in test/tanglecheck.sh (or a small test/steer<lang>check.sh, registered in test/regression.sh in the same commit, or test/manifestcheck.sh fails): steerfar prints steer="1", steernear prints no steer=, and the cursor and scope near misses print no steer=. Red on main first. The metrics are cached: bump kParserVer (src/ingest_cache.h:409) and its mirror kIngestParserVerMirror (src/quality.h:3335) to any number above main's, and run bash test/qschemetripcheck.sh.
Acceptance criteria (per language)
steerfarsteer="1"; the three near misses print nosteer=.bash test/tanglecheck.sh "$PWD/build/ripwire"passes, with the new arms red onmain.bash test/langidentitycheck.sh origin/main HEAD --langs=<your lang>,java,py,ts,cpp --repo=<lang>:<your clone>: every other language is SAME. Your language DIFFs only onsteer/tangle(and the--quality-deltatangle rows built on them), waived by--intendedrows naming the arm. Hand-check ten moved functions on the real repository and say how many were real steering locals.ripwire . --quality-delta=origin/main..HEADgates 0.
How to verify locally
cmake -S . -B build && cmake --build build -j # plain build: no build type
./build/ripwire /path/to/your/fixture --no-cache --metrics --page-bytes=0 | grep -o '<s [^>]*n="steer[a-z]*"[^>]*'
bash test/tanglecheck.sh "$PWD/build/ripwire"
bash test/qschemetripcheck.sh
bash test/langidentitycheck.sh origin/main HEAD --langs=<lang>,java,py,ts,cpp --repo=<lang>:/path/to/a/real/repo
./build/ripwire . --quality-delta=origin/main..HEAD --legend=compact
Not in scope
Changing the steering rule itself (the 10-statement distance, the cursor and scope exclusions), or the tangle score formula.
Comment here with the language you are taking, then open one PR per language with Refs #<this issue>. Every contributor is credited by handle in the CHANGELOG entry and the release notes. Thank you!
- Lingua principale
- C++
- Stelle
- 2.6k
- Fork
- 182
- Merge medio
- 21h 12m
- PR unite (30g)
- 262
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di redhat-et/ripwire
-
bug good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
TS/JS: a generator function expression (const f = function* / async function*) is not indexedForse già presa @shivam512262 l’ha presa 6 giorni fa. Apertabug good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
redhat-et/ripwire#730 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 Meno di un'ora Idoneità per principianti 78/100
redhat-et/ripwire#334 · 8 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
redhat-et/ripwire#68 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement help wanted
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di redhat-et/ripwire
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
riscv-software-src/riscv-isa-sim#2640 ·
I maintainer di solito rispondono entro 1 giorno
-
difficulty:easy func:gui prio:normal type:bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
NatronGitHub/Natron#2118 ·
I maintainer di solito rispondono entro 1 giorno
-
Bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
-
mechanics UI
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
endless-sky/endless-sky#12949 ·
I maintainer di solito rispondono entro 1 giorno
-
bug difficulty:easy prio:low
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
NatronGitHub/openfx-io#523 ·
I maintainer di solito rispondono entro 1 giorno