The object_usage_linter won't acknowledge bindings from @import or @importFrom
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- r, typescript, vscode
- 領域
- tooling
調査の方向性
パッケージ設定と R/test.R の例で警告を再現し、VSCode の Problems パネルを devtools::check() および lintr::lint("R/test.R") と比較します。vscode-R 拡張機能がパッケージ化された lintr の object_usage_linter をどのように呼び出しているか、また @import と @importFrom がどのように処理されているかを追跡します。完了の条件は、インポートされた binding が VSCode で誤った .data 警告を生成しなくなり、既存の lintr チェックが引き続き通過することです。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
The object_usage_linter that comes installed with vscode-R's lintr won't recognize functions added to package scope via @import and @importFrom calls. The linter that runs via devtools::check() or calling lintr::lint() directly, however, will. As such, there seems to be a bug in the lintr that comes packaged with vscode-R but not in other instances of lintr.
To Reproduce
Steps to reproduce the behavior:
- Create an R package via the R console
usethis::create_package("Test") - Run
usethis::use_mit_license() - Open the package in VSCode where you have the R extension installed
- Import deplyr and ggplot2 in the
DESCRIPTIONfile
Package: Test
Title: What the Package Does (One Line, Title Case)
Version: 0.0.0.9000
Authors@R:
person("First", "Last", , "[email protected]", role = c("aut", "cre"))
Description: What the package does (one paragraph).
License: MIT + file LICENSE
Imports:
dplyr,
ggplot2,
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
- Create an R file called test in the R directory
R/test.R - Paste these functions into test.R
#' Group rows by name
#'
#' This function groups the rows of a data frame by the column "name"
#' @param df A data frame.
#'
#' @import ggplot2
#' @return A grouped data frame.
#' @export
group_by_name <- function(df) {
data_grouped <- df |>
dplyr::group_by(.data$name)
data_grouped
}
#' Group rows by size
#'
#' This function groups the rows of a data frame by the column "size"
#' @param df A data frame.
#'
#' @importFrom ggplot2 .data
#' @return A grouped data frame.
#' @export
group_by_size <- function(df) {
data_grouped <- df |>
dplyr::group_by(.data$size)
data_grouped
}
- Run
devtools::document()anddevtools::load_all() - Go to problems panel or hover over .data in each of the functions and note the
no visible binding for global variable '.data'warnings.
- Run
devtools::check()and see that no errors, warnings, or notes arise - Run
lintr::lint("R/test.R")and seeℹ No lints found.
Can you fix this issue by yourself? (We appreciate the help)
No, attempting to reinstall the R, the vscode-R extension, and rlanguageserver have not helped. Here is my settings.json file:
{
"git.autofetch": true,
"git.confirmSync": false,
"[r]": {
"editor.defaultFormatter": "REditorSupport.r"
},
"r.rterm.mac": "/usr/local/bin/R",
}
Expected behavior
An @import or @importFrom call should update the global namespace such that the imported function is defined for the object_usage_linter in the lintr package included by the vscode-R extension.
Screenshots
Environment (please complete the following information):
- OS: macOS
- VSCode Version: 1.99.0 (Universal)
- R Version: R version 4.4.2 (2024-10-31)
- vscode-R version: 2.8.4
Additional context
Folks have a lot of issues with the object_usage_linter in lintr but I didn't find any that pertain directly to this, and as mentioned above, this doesn't seem to be an issue when invoking lintr without the vscode-R extension.
- 主要言語
- TypeScript
- スター
- 1.2k
- フォーク
- 139
- 平均マージ
- 22時間
- マージ済み PR(30日)
- 23
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
REditorSupport/vscode-R のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
REditorSupport/vscode-R#1687 · コメント 4 件 · リアクション 3 件 ·
メンテナーはふだん 1 日以内に返信
-
feature-request
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
REditorSupport/vscode-R#1780 ·
メンテナーはふだん 1 日以内に返信
-
REditorSupport/vscode-R#1772 · コメント 4 件 · 担当者 2 名 ·
メンテナーはふだん 1 日以内に返信
-
feature-request
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
REditorSupport/vscode-R#1763 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
REditorSupport/vscode-R#1755 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
REditorSupport/vscode-R の issue をすべて見る
似ている issue
-
resources
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
railmapgen/rmg-palette#2445 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
danielmiessler/LifeOS#2242 ·
メンテナーはふだん 5 日以内に返信
-
good first issue hacktoberfest help wanted translation
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
callstackincubator/appduct#129 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100