Giter VIP home page Giter VIP logo

Comments (1)

lorenzwalthert avatar lorenzwalthert commented on September 1, 2024 1

Hi @jeancochrane, thanks for the detailed and well-linked issue, haven't seen anything alike for a while 👍

Let's first talk about potential fixes:

It looks like a try_fetch call was added in r-lib/styler@54df59b and released in v1.10.3 in an attempt to suppress the error; I believe that we're still seeing the error in our precommit calls because precommit is pinned to 1.10.2, so one possible solution would be to just bump styler to 1.10.3 in precommit.

Yes, everything correct. You can also use it by adding r-lib/styler@ v1.10.3 as an additional_dependencies to your .pre-commit-config.yaml. I will probably at some point release a new hook release to include the latest {styler} version.

Now about the root cause:

While I'm not totally sure of this root cause analysis, I do feel confident that the problem is due to some sort of race condition in the getCachePath() call in remove_old_cache_files

In that case, I think it would be best solved in the {R.cache} package, since {styler} is only leveraging that infrastructure. I am not sure how deep you deep you digged but the issue I opened in {R.cache} is this one: HenrikBengtsson/R.cache#51. I guess as you say, getCachePath() is potentially not designed to work in a parallel setup, so creating a reprex with the failure that only involves {R.cache} might be a good starting point. Alternatively, just implement logic to make it work in parallel is another.

I expect it could be resolved pretty easily by switching to an alternative way of constructing that directory path that doesn't create the directory, like file.path(tools::R_user_dir("R.cache", which = "cache"), "styler", styler_version)

I would not want to do that since I prefer to use the public API of {R.cache} to interact with the cache. In particular if {R.cache} changes its internals, the above code won't potentially give me the correct path to the cache.

from precommit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.