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

Fix #320: ignore the magrittr dot (.) #321

Merged
merged 2 commits into from
Mar 14, 2018
Merged

Fix #320: ignore the magrittr dot (.) #321

merged 2 commits into from
Mar 14, 2018

Conversation

wlandau
Copy link
Collaborator

@wlandau wlandau commented Mar 14, 2018

Summary

From #320 and duncantl/CodeDepends#26, the magrittr dot (.) is sometimes treated as a dependency even when it is just a placeholder symbol. Detection depends on the context of the rest of the code in the static analysis. In the case of drake, this is a bit mysterious, and the behavior on master may invalidate targets unpredictably.

This PR forces (.) to never be a dependency, even when the user references it outside the intended tidyverse context. So if the user tries to reference (.) in a command as an ordinary variable, drake will still ignore it. That is fine with me because it is almost never something we should expect users to do and this PR documents it in the `caution.Rmd vignette. I think we should maximize consistency and minimize surprises.

@AlexAxthelm, I wanted to add you as a reviewer for this PR, but I cannot request anyone outside the list. May I add you as a collaborator in the repo settings for subsequent PRs?

GitHub issues fixed

Checklist

  • I have read drake's code of conduct, and I agree to follow its rules.
  • I have read the guidelines for contributing.
  • I have listed any substantial changes in the development news.
  • I have added testthat unit tests to tests/testthat to confirm that any new features or functionality work correctly.
  • I have tested this pull request locally with devtools::check()
  • This pull request is ready for review.
  • I think this pull request is ready to merge.

@codecov-io
Copy link

codecov-io commented Mar 14, 2018

Codecov Report

Merging #321 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #321   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          66     66           
  Lines        5176   5177    +1     
=====================================
+ Hits         5176   5177    +1
Impacted Files Coverage Δ
R/dependencies.R 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f438cfa...dc231e1. Read the comment docs.

Copy link
Collaborator

@AlexAxthelm AlexAxthelm left a comment

Choose a reason for hiding this comment

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

These look great to me. Also feel free to add me to the repo, if you think that will be helpful for the future.

@wlandau
Copy link
Collaborator Author

wlandau commented Mar 14, 2018

Thanks, Alex! Kirill, free to chime in when it is convenient for you.

@wlandau wlandau merged commit a92c358 into master Mar 14, 2018
Copy link
Collaborator

@krlmlr krlmlr left a comment

Choose a reason for hiding this comment

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

Thanks, makes sense to me.

@@ -357,14 +357,14 @@ find_globals <- function(expr){
}
# Warning: In collector$results(reset = reset) :
# partial argument match of 'reset' to 'resetState'

suppressWarnings(inputs <- CodeDepends::getInputs(expr))
base::union(
inputs@inputs,
names(inputs@functions)
) %>%
setdiff(y = c(formals, drake_fn_patterns)) %>%
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe just add the dot up there?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch. See 3ef462e.

@wlandau wlandau deleted the i320 branch March 18, 2018 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants