Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polish lint and styling actions #295

Merged
merged 67 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
108b61b
check pre-commit code checks and formatters via precommit-ci-lite bot
philipp-baumann Sep 12, 2024
f9b040f
fix according pre-commit hoooks
philipp-baumann Sep 12, 2024
a99e688
debug: slim down hooks to styler
philipp-baumann Sep 13, 2024
be6b395
remove roxygenize
philipp-baumann Sep 13, 2024
1048dae
avoid pre-commit action and only use the lite (applies fixes)
philipp-baumann Sep 13, 2024
ba7ca89
add space to test linter
philipp-baumann Sep 13, 2024
f2c9995
use latest; add back precommit action
philipp-baumann Sep 13, 2024
026e8f6
now after pre-commit-lite ci enabled
philipp-baumann Sep 13, 2024
8c51a0c
disable unused hooks
philipp-baumann Sep 13, 2024
b8d6bf0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 13, 2024
6c46d03
parsable R and no browser()
philipp-baumann Sep 13, 2024
f38c3a2
remove old lintr action
philipp-baumann Sep 13, 2024
9e8b9db
avoid race conditions
philipp-baumann Sep 13, 2024
17894c4
also add .lintr hook
philipp-baumann Sep 13, 2024
95efc16
please lintr
philipp-baumann Sep 13, 2024
276b3b6
exclude test-fetchers.R
philipp-baumann Sep 13, 2024
4aba03f
exclude lintr
philipp-baumann Sep 13, 2024
d393956
update linter config, fix lints
philipp-baumann Sep 14, 2024
07755af
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 14, 2024
1699a4b
fix lints
philipp-baumann Sep 14, 2024
308960b
Merge remote-tracking branch 'refs/remotes/origin/precommit-ci-lite-l…
philipp-baumann Sep 14, 2024
b55a097
fix more lints
philipp-baumann Sep 14, 2024
ee536cc
fix lint cmd
philipp-baumann Sep 14, 2024
24d802f
lint
philipp-baumann Sep 14, 2024
1d7ccb9
again fix remaing lint errors
philipp-baumann Sep 14, 2024
a16202d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 14, 2024
f3bcb1d
fix lints
philipp-baumann Sep 14, 2024
e83d9cc
exclude from lintr
philipp-baumann Sep 14, 2024
e1a05c7
fix rhub nix runner to use current branch
philipp-baumann Sep 14, 2024
d3eb26f
exclude vignettes
philipp-baumann Sep 14, 2024
5d93726
more fixes
philipp-baumann Sep 14, 2024
e2aedaa
try fix rhub gh url
philipp-baumann Sep 14, 2024
39a39f8
remote already there
philipp-baumann Sep 14, 2024
04d3f2b
Merge branch 'main' into precommit-ci-lite-linter
philipp-baumann Sep 16, 2024
c10c2bd
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 16, 2024
b5fe46d
add docopt for precommit nix R hooks
philipp-baumann Sep 16, 2024
e83f8bb
Merge remote-tracking branch 'refs/remotes/origin/precommit-ci-lite-l…
philipp-baumann Sep 16, 2024
a421aba
use forked action
philipp-baumann Sep 16, 2024
9eefc15
use fixed fork revision
philipp-baumann Sep 16, 2024
ad1211a
test nix styler
philipp-baumann Sep 16, 2024
049e68a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 16, 2024
b6020de
no renv
philipp-baumann Sep 16, 2024
d12e833
Merge remote-tracking branch 'refs/remotes/origin/precommit-ci-lite-l…
philipp-baumann Sep 16, 2024
ceb15e6
add precommit to the dev env
philipp-baumann Sep 16, 2024
83f2e30
update fork revision
philipp-baumann Sep 16, 2024
8c66d2f
lint with flint
philipp-baumann Sep 16, 2024
17a5741
update precommit fork revision
philipp-baumann Sep 16, 2024
016a51e
do an extra precommit clean and use original R action
philipp-baumann Sep 16, 2024
d4d8f2d
clean cache
philipp-baumann Sep 16, 2024
2ffc9de
direct styling, no extra PR
philipp-baumann Sep 16, 2024
363c25a
fix styling
philipp-baumann Sep 16, 2024
65c8faa
manual fix
philipp-baumann Sep 16, 2024
42c94c7
do pull before committing
philipp-baumann Sep 16, 2024
3ae73f5
add fetch PR
philipp-baumann Sep 16, 2024
4077475
Style
philipp-baumann Sep 16, 2024
2786531
remove precommit
philipp-baumann Sep 16, 2024
1d89a9d
Merge remote-tracking branch 'refs/remotes/origin/precommit-ci-lite-l…
philipp-baumann Sep 16, 2024
fd411f7
commit only if changes
philipp-baumann Sep 16, 2024
2d5f20a
run rhub nix action only on main not in PR
philipp-baumann Sep 16, 2024
705e3b2
add lintr and combine lint-and-style action
philipp-baumann Sep 16, 2024
a68af1f
name and rename action
philipp-baumann Sep 16, 2024
0137a6f
fix syntax
philipp-baumann Sep 16, 2024
673734b
exclude files from lints
philipp-baumann Sep 16, 2024
385f5cf
reformat
philipp-baumann Sep 16, 2024
2ecc2e0
fix linter config format
philipp-baumann Sep 16, 2024
dc9a962
add flint to ignores and set up flint
philipp-baumann Sep 16, 2024
fdd2889
add flint rules
philipp-baumann Sep 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix more lints
  • Loading branch information
philipp-baumann committed Sep 14, 2024
commit b55a0972e93f7c02805ed64fa66016bb64dd52b8
4 changes: 3 additions & 1 deletion R/make_nixpkgs_url.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' make_nixpkgs_url Find the right Nix revision
#' @param r_version Character. R version to look for, for example, "4.2.0". If a nixpkgs revision is provided instead, this gets returned.

Check warning on line 2 in R/make_nixpkgs_url.R

View workflow job for this annotation

GitHub Actions / main

file=/home/runner/work/rix/rix/R/make_nixpkgs_url.R,line=2,col=101,[line_length_linter] Lines should not be more than 100 characters. This line is 138 characters.
#' @return A character. The url to use
#'
#' @examples
Expand All @@ -15,7 +15,9 @@
latest_commit <- get_latest(r_ver)

list(
"url" = paste0("https://github.com/", github_repo, "archive/", latest_commit, ".tar.gz"),
"url" = paste0(
"https://github.com/", github_repo, "archive/", latest_commit, ".tar.gz"
),
"latest_commit" = latest_commit,
"r_ver" = r_ver
)
Expand Down
9 changes: 7 additions & 2 deletions R/nix_hash.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,21 @@ nix_sri_hash <- function(path) {

# not needed for Nix R sessions, workaround on Debian and Debian-based
# systems with nix installed
# nolint start: object_name_linter
LD_LIBRARY_PATH_default <- Sys.getenv("LD_LIBRARY_PATH")
needs_ld_fix <- isFALSE(nzchar(Sys.getenv("NIX_STORE"))) &&
nzchar(LD_LIBRARY_PATH_default)
# nolint end

if (isTRUE(needs_ld_fix)) {
# On Debian and Debian-based systems, like Ubuntu 22.04, we found that a
# preset `LD_LIBRARY_PATH` environment variable in the system's R session
# leads to errors like
# nix-hash: /usr/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.38' not found (required by nix-hash)
# nix-hash: /usr/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.38' not found (required by /nix/store/4z754a0vzl98asv0pa95i5d9szw5jqbs-lowdown-1.0.2-lib/lib/liblowdown.so.3)
# nix-hash: /usr/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.38'
# not found (required by nix-hash)
# nix-hash: /usr/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.38'
# not found (required by # nolint next: line_length_linter
# /nix/store/4z754a0vzl98asv0pa95i5d9szw5jqbs-lowdown-1.0.2-lib/lib/liblowdown.so.3)
# etc...
# for both `nix-hash`; it occurs via
# `sys::exec_internal`, `base::system()` or `base::system2()` from R.
Expand Down
6 changes: 5 additions & 1 deletion R/with_nix.R
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ with_nix <- function(expr,
project_path = ".",
message_type = c("simple", "quiet", "verbose")) {
nix_file <- file.path(project_path, "default.nix")
# nolint start: line_length_linter
stopifnot(
"`project_path` must be character of length 1." =
is.character(project_path) && length(project_path) == 1L,
Expand All @@ -143,6 +144,7 @@ with_nix <- function(expr,
"`expr` needs to be a call or function for `program = R`, and character of length 1 for `program = shell`" =
is.function(expr) || is.call(expr) || (is.character(expr) && length(expr) == 1L)
)
# nolint end

program <- match.arg(program, choices = c("R", "shell"))
message_type <- match.arg(message_type,
Expand Down Expand Up @@ -170,11 +172,12 @@ with_nix <- function(expr,
current_libpaths <- .libPaths()
# don't do this in covr test environment, because this sets R_LIBS_USER
# to multiple paths
R_LIBS_USER <- Sys.getenv("R_LIBS_USER")
R_LIBS_USER <- Sys.getenv("R_LIBS_USER") # nolint: object_name_linter
if (isFALSE(nzchar(Sys.getenv("R_COVR")))) {
remove_r_libs_user()
}
} else {
# lolint start: object_name_linter
LD_LIBRARY_PATH_default <- Sys.getenv("LD_LIBRARY_PATH")
if (nzchar(LD_LIBRARY_PATH_default)) {
# On some systems, like Ubuntu 22.04, we found that a preset
Expand All @@ -195,6 +198,7 @@ with_nix <- function(expr,
)
cat("\n", "Setting `LD_LIBRARY_PATH` to `''` during `nix_build()`")
}
# nolint end
}

has_nix_shell <- nix_shell_available() # TRUE if yes, FALSE if no
Expand Down
Loading