The object_usage_linter won't acknowledge bindings from @import or @importFrom
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- r, typescript, vscode
- Lĩnh vực
- tooling
Hướng nghiên cứu
Tái hiện cảnh báo với cấu hình package và ví dụ R/test.R, sau đó so sánh bảng Problems của VSCode với devtools::check() và lintr::lint("R/test.R"). Theo dõi cách extension vscode-R gọi object_usage_linter được đóng gói của lintr và cách @import và @importFrom được xử lý. Công việc được xem là hoàn tất khi các binding được import không còn tạo ra các cảnh báo .data giả trong VSCode và các kiểm tra lintr hiện có vẫn tiếp tục vượt qua.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 1.2k
- Fork
- 139
- Merge trung bình
- 23 giờ 31 phút
- Pull request đã merge (30 ngày)
- 13
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của REditorSupport/vscode-R
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
REditorSupport/vscode-R#1687 · 4 bình luận · 3 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
feature-request
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
REditorSupport/vscode-R#1763 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
REditorSupport/vscode-R#1755 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
REditorSupport/vscode-R#1751 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
REditorSupport/vscode-R#1749 · 5 bình luận · 3 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của REditorSupport/vscode-R
Issue tương tự
-
ADD openalgoĐang mởtemplate
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
factory-active factory-automatic task-bug-reproduction-success task-identify-harness-labels-done task-identify-issue-type-done
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
vercel/ai#21528 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug Needs: Triage :mag:
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
microsoft/fluentui-contrib#671 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
sveltejs/acorn-typescript#150 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100