[Feature Request]: Remove unused functions

オープン
#196 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
リファクタリング
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
r
領域
tooling

調査の方向性

提供された R スクリプトから始め、teal.transform に列挙されている各関数について、R/, tests/, vignettes/, data-raw/、および inst/ 以下でスクリプトが見つけた参照を調べます。@examples でのみ参照されている関数も含め、各関数を個別に評価します。パッケージで引き続き必要な関数を削除せず、使用されていないことが確認された関数を削除できた時点で作業は完了です。

索引モデルが issue の本文から書いたものです。

説明

core enhancement
Feature description

List of unused functions in {teal.transform}:

note: functions being referenced on this list don't necessarily mean that they "should" be removed. They should be assessed case-by-case.

  • call_condition_logical
  • call_condition_range_date
  • call_condition_range_posixct
  • call_extract_array
  • get_initial_filter_values
  • check_data_extract_spec_react
  • extract_choices_labels

Functions only used in @examples

  • call_extract_list
  • call_condition_range
  • call_with_colon
Methods

Functions were detected with script below that uses grep and enhanced with {crayon} for better readability.

🔎 R script
# Get all the functions in the namespace
all_ns <- ls(getNamespace("teal.transform"))

# Get only exported functions
all_exported <- getNamespaceExports("teal.transform")

# Determine S3Methods to exclude
s3_methods <- all_ns |> vapply(isS3method, logical(1)) |> which() |> names()

# Filter out all exported functions and S3 methods
non_exported <- setdiff(setdiff(all_ns, s3_methods), all_exported)

# Use native `grep` to find occurences in source folder
output_path <- withr::local_file("non_exported.txt")

output_con <- file(output_path, open = "wt")

non_exported |> 
  sort() |> 
  purrr::walk(
    function(x) {
      writeLines("----------------------------------", output_con)
      writeLines("", output_con)
      writeLines("", output_con)
      writeLines(glue::glue("    {x}    "), output_con)
      writeLines("", output_con)
      writeLines("", output_con)
      
      result <- system2(
        "grep",
        c(
          "-n",
          glue::glue("\"{x}\""),
          "-R R/ tests/ vignettes/ data-raw/ inst/"
        ),
        stdout = TRUE
      ) |> 
        stringr::str_replace_all(
          glue::glue(":(.+?){x}(.+)"), 
          glue::glue(":\\1", crayon::red(x), "\\2")
        ) |> 
        stringr::str_replace_all(
          "^(.+?):([0-9]+):", 
          glue::glue(crayon::green("\\1"), ":", crayon::magenta("\\2"), ":")
        ) 
      
      writeLines(result, output_con)
      flush(output_con)
    }
  )
close(output_con)
readLines(output_path) |> cat(sep = "\n")
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.
主要言語
R
スター
2
フォーク
5
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

pharmaverse/teal.transform のほかの issue

pharmaverse/teal.transform の issue をすべて見る

似ている issue

R の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。