Git Product home page Git Product logo

Comments (2)

AguileraG avatar AguileraG commented on August 20, 2024 1

I found out the real source of my issue, it seems that clang-format and VSCode have some interaction that triggers the reconfiguration after I run pre-commit. Everything works as expected when building the project through the command line.

I will close the issue as gersemi is working fine, and I do not have any other use case for ignoring files.

from gersemi.

BlankSpruce avatar BlankSpruce commented on August 20, 2024

I'm not sure if it's really necessary to do that for this case in particular. Honestly I consider placing build directory inside project directory an anti-pattern because I've seen instances where it led to problems while out-of-project build was usually more robust because you have to avoid baking in assumptions about build directory.

Having said that, let's assume that you have a good reason to go with such directory layout. If I'm reading pre-commit doc correctly then you could avoid this by not using --all-files since you're interested only in proper formatting of staged files:

Some example useful invocations:
pre-commit run: this is what pre-commit runs by default when committing. This will run all hooks against currently staged files.
pre-commit run --all-files: run all the hooks against all the files. This is a useful invocation if you are using pre-commit in CI.
pre-commit run flake8: run the flake8 hook against all staged files.

Another thing is that pre-commit itself offers providing pattern for excluding certain files through exclude key so you could improve your experience through that configuration. Disclaimer: I'm not using pre-commit daily so if I've misread docs about these two pre-commit features please let me know.

If there was a stronger example provided for implementing this kind of feature we could discuss that.

from gersemi.

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.