Skip to content

Commit

Permalink
filter "Lost braces" as note not error
Browse files Browse the repository at this point in the history
  • Loading branch information
sorhawell committed Oct 15, 2023
1 parent 479e940 commit 7c1bd31
Showing 1 changed file with 22 additions and 23 deletions.
45 changes: 22 additions & 23 deletions inst/misc/filter_rcmdcheck.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,55 +9,54 @@ print(R.version)
print(Sys.info())
print(getwd())

# define ignore rules for notes, warnings and errors
#define ignore rules for notes, warnings and errors
ignore_rules = list(
notes = list(
# if note contains this phrase then skip it by returning TRUE.
# yes polars is huge way above 10Mb nothing to do about that
#NOTE-A if note contains this phrase then skip it by returning TRUE.
#yes polars is huge way above 10Mb nothing to do about that
ignore_lib_size = function(msg) {
isTRUE(grepl("checking installed package size ... NOTE", msg))
}
),
warnings = list(),
errors = list(
isTRUE(grepl("checking installed package size ... NOTE",msg))
},

# R4.3.x devel now requires no unquoted braces '{' in docs. This filter turns off that error
#NOTE-B R4.3.x devel now requires no unquoted braces '{' in docs. This filter turns off that error
# until fixed likely via PR #424
ignore_lost_braces = function(msg) {
isTRUE(grepl("Lost braces", msg))
isTRUE(grepl("Lost braces",msg))
}
)
),

warnings = list(),

errors = list()
)


# drop any filter if FILTER_CHECK_NO_FILTER = true
#drop any filter if FILTER_CHECK_NO_FILTER = true
if (Sys.getenv("FILTER_CHECK_NO_FILTER") == "true") {
ignore_rules$notes = list()
ignore_rules$warnings = list()
ignore_rules$errors = list()
}


# helper function
# iterate a msg_set, as notes, warnings, errors and drop those where an ignore rule returns TRUE
#helper function
#iterate a msg_set, as notes, warnings, errors and drop those where an ignore rule returns TRUE
drop_ignored = function(msg_set, rule_list) {
ignore_these = sapply(msg_set, function(note) {
any(sapply(rule_list, function(f) isTRUE(f(note))))
ignore_these = sapply(msg_set, function(note){
any(sapply(rule_list,function(f) isTRUE(f(note))))
}) |> as.logical()
msg_set[!ignore_these]
}

# parse check report to object
#parse check report to object
check_report_path = c(
Sys.getenv("rcmdcheck_path"),
"./check/polars.Rcheck/"
) |> (\(x) {
x[nzchar(x)]
})()
) |> (\(x) {x[nzchar(x)]})()
check_obj = rcmdcheck::parse_check(check_report_path)


# filter remaining not-ignored msgs
#filter remaining not-ignored msgs
remaining_erros = unlist(lapply(
c(notes = "notes", warnings = "warnings", errors = "errors"),
function(msg_type) {
Expand All @@ -66,8 +65,8 @@ remaining_erros = unlist(lapply(
))


# raise any remaining errors
if (length(remaining_erros)) {
#raise any remaining errors
if( length(remaining_erros)) {
stop(remaining_erros)
print("some errors where not ignored, and will be raised right now!")
} else {
Expand Down

0 comments on commit 7c1bd31

Please sign in to comment.