Skip to content

Commit

Permalink
enable the assignment linter
Browse files Browse the repository at this point in the history
  • Loading branch information
aronatkins committed Jan 6, 2023
1 parent d8356b7 commit 267b9ed
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
1 change: 0 additions & 1 deletion .lintr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ linters: linters_with_defaults(
object_length_linter(80),
object_name_linter = NULL,
object_usage_linter = NULL,
assignment_linter = NULL,
brace_linter = NULL,
commented_code_linter = NULL,
cyclocomp_linter = NULL,
Expand Down
20 changes: 10 additions & 10 deletions R/aaa-globals.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,32 @@

## Mutable values that might be modified by the user (code borrowed from knitr)
# merge elements of y into x with the same names
merge_list = function(x, y) {
x[names(y)] = y
merge_list <- function(x, y) {
x[names(y)] <- y
x
}

new_defaults = function(value = list()) {
defaults = value
new_defaults <- function(value = list()) {
defaults <- value

get = function(name, default = FALSE, drop = TRUE) {
if (default) defaults = value # this is only a local version
get <- function(name, default = FALSE, drop = TRUE) {
if (default) defaults <- value # this is only a local version
if (missing(name)) defaults else {
if (drop && length(name) == 1) defaults[[name]] else {
setNames(defaults[name], name)
}
}
}
set = function(...) {
dots = list(...)
set <- function(...) {
dots <- list(...)
if (length(dots) == 0) return()
if (is.null(names(dots)) && length(dots) == 1 && is.list(dots[[1]]))
if (length(dots <- dots[[1]]) == 0) return()
defaults <<- merge(dots)
invisible(NULL)
}
merge = function(values) merge_list(defaults, values)
restore = function(target = value) defaults <<- target
merge <- function(values) merge_list(defaults, values)
restore <- function(target = value) defaults <<- target

list(get = get, set = set, merge = merge, restore = restore)
}
Expand Down
4 changes: 2 additions & 2 deletions R/hooks.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ snapshotHook <- function(expr, value, ok, visible) {
project <- .packrat_mutables$get("project")

if (is.null(project)) {
file = "" ## to stdout
file <- "" ## to stdout
} else {
file = file.path(project, "packrat", "packrat.log")
file <- file.path(project, "packrat", "packrat.log")
}

if (inherits(e, "simpleError")) {
Expand Down
2 changes: 1 addition & 1 deletion R/rstudio-protocol.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# the protocol version number, is used to determine whether the package is too
# old to be compatible.

.RStudio_protocol_version = 1
.RStudio_protocol_version <- 1

0 comments on commit 267b9ed

Please sign in to comment.