Skip to content

Simplify find config #2205

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

Merged
merged 4 commits into from
Sep 21, 2023
Merged

Simplify find config #2205

merged 4 commits into from
Sep 21, 2023

Conversation

MichaelChirico
Copy link
Collaborator

Feeds into #2177

I found the structure of the while() loop confusing, it took me quite some time to figure out it's checking both ${PATH}/.lintr and ${PATH}/.github/linters/.lintr on each pass.

I hope this rewrite makes what's going on much clearer. It will also make it trivial to extend for #2177 to also check for .lintr.R.

@codecov-commenter
Copy link

codecov-commenter commented Sep 21, 2023

Codecov Report

Merging #2205 (774ffb9) into main (2a5e4ab) will not change coverage.
The diff coverage is 100.00%.

❗ Current head 774ffb9 differs from pull request most recent head 1689bce. Consider uploading reports for the commit 1689bce to get more accurate results

@@           Coverage Diff           @@
##             main    #2205   +/-   ##
=======================================
  Coverage   99.65%   99.65%           
=======================================
  Files         113      113           
  Lines        5161     5161           
=======================================
  Hits         5143     5143           
  Misses         18       18           
Files Changed Coverage Δ
R/settings_utils.R 100.00% <100.00%> (ø)

#' TODO(#2204): check if the implementation should be simpler
#' @noRd
first_exists <- function(files) {
for (file in files) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be avoided because file.exists() is vectorized.
Not sure if faster, we should check:

file_exists <- file.exists(files)
if (any(file_exists)) {
  files[which.max(file_exists)]
} else {
  NULL
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's the #2204 TODO -- I wanted to punt on that for now :)

@AshesITR AshesITR merged commit d44de7f into main Sep 21, 2023
@AshesITR AshesITR deleted the simplify-find-config branch September 21, 2023 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants