Skip to content

Enable cache on linting #28

Description

@serl

Problem description

We use both taplo-format and taplo-lint hooks in all our repositories. That's fantastic, but it feels a little slow.
Digging a little more, looks like taplo-lint fetches data from the internet on each run, and depending on the network, that adds a handful of seconds (or plain time-out error), which is bad for a pre-commit hook.

Proposed solution

taplo implements caching already!

After a mkdir .taplo-cache on my local repo, this works like a charm:

  - repo: https://github.com/ComPWA/taplo-pre-commit
    rev: v0.9.3
    hooks:
      - id: taplo-lint
        args: [--default-schema-catalogs, --cache-path=.taplo-cache]

While that works, there are some drawbacks:

  • cache is not shared between projects (while I guess it's always the same)
  • the .taplo-cache directory must exist already: taplo does not create by itself nor errors out when that's missing

Given that pre-commit creates a venv when running these hooks, it would be fantastic if the cache was over there.

What do you think? I'd like to create a PR if we agree on this issue. Also, if you have any suggestion don't hesitate.

What should the interface look like?

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

⚙️ EnhancementImprovements and optimizations of existing features

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions