Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[Feature Request]: Support code dependency on a single expression with multiple assignments

Aperta
#251 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
65/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
r
Ambito
tooling

Direzione di ricerca

Inizia dai punti di ingresso eval_code() e get_code() descritti nell’issue, quindi esegui i casi di testthat forniti per le assegnazioni concatenate. Implementa il supporto per <-, -> e per le catene di assegnazioni miste, in modo che ogni variabile assegnata restituisca l’espressione originale, e verifica che tutti e tre gli esempi abbiano esito positivo.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

core enhancement
Feature description

Such as var1 <- var2 <- 2

pkgload::load_all("../teal.code")
#> ℹ Loading teal.code
code <- "var1 <- var2 <- 1"
td <- eval_code(qenv(), code)
get_code(td, names = "var1")
#> [1] "var1 <- var2 <- 1"
get_code(td, names = "var2")
#> Warning: Object(s) not found in code: var2.
#> [1] ""

Created on 2025-04-30 with reprex v2.1.1

See test suite below for test-driven development

testthat::describe("detects multiple assignments in single line", {
  testthat::it("<-", {
    # testthat::skip("Not implemented")
    code <- "var1 <- var2 <- 1"
    td <- eval_code(qenv(), code)

    testthat::expect_identical(get_code(td, names = "var1"), code)
    testthat::expect_identical(get_code(td, names = "var2"), code)
  })

  testthat::it("->", {
    code <- "1 -> var1 -> var2"
    td <- eval_code(qenv(), code)

    testthat::expect_identical(
      get_code(td, names = "var1"),
      as.character(parse(text = code, keep.source = TRUE))
    )

    testthat::expect_identical(get_code(td, names = "var1"), code)
    testthat::expect_identical(get_code(td, names = "var2"), code)
  })

  testthat::it("<- and ->", {
    code <- "var1 <- 1 -> var2"
    td <- eval_code(qenv(), code)

    testthat::expect_identical(get_code(td, names = "var1"), code)
    testthat::expect_identical(get_code(td, names = "var2"), code)
  })
})
Code of Conduct
  • I agree to follow this project's Code of Conduct.
Contribution Guidelines
  • I agree to follow this project's Contribution Guidelines.
Security Policy
  • I agree to follow this project's Security Policy.
Lingua principale
R
Stelle
12
Fork
11
Merge medio
8g 15h
PR unite (30g)
2

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di insightsengineering/teal.code

Tutte le issue di insightsengineering/teal.code

Issue simili

Altre issue su R

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.