Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#251 0 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
65/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
r
Lĩnh vực
tooling

Hướng nghiên cứu

Bắt đầu với các entry point eval_code() và get_code() được mô tả trong issue, sau đó chạy các test case testthat được cung cấp cho phép gán chuỗi. Triển khai hỗ trợ cho <-, -> và các chuỗi phép gán kết hợp để mọi biến được gán đều trả về biểu thức ban đầu, đồng thời xác nhận cả ba ví dụ đều đạt.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.
Ngôn ngữ chính
R
Star
12
Fork
11
Merge trung bình
8 ngày 15 giờ
Pull request đã merge (30 ngày)
2

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của insightsengineering/teal.code

Tất cả issue của insightsengineering/teal.code

Issue tương tự

Thêm issue về R

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.