Giter VIP home page Giter VIP logo

Comments (1)

guillaumeaubert avatar guillaumeaubert commented on June 14, 2024

There are two potential parts to your request:

1) Checking that files don't report any issues with Code::TidyAll and preventing the user from committing when they do.

Conceptually, this is very similar to App::GitHooks::Plugin::PerlCritic, and the behavior would be the same as Code::TidyAll::Git::Precommit.

The only potential problem here is the level of detail bubbled up by Code::TidyAll::Result for the line number of issues detected. Several App::GitHooks plugins (for example: App::GitHooks::Plugin::PerlCritic) review the line number(s) of issues, to detect if the issues are in changes you're committing or in changes that predated your current edit. This avoids forcing the user to clean up / fix an entire file if they're just trying to make a one line fix, but it looks like implementing line-level matching would be difficult for Code::TidyAll. The plugin could try to parse the output, but as the output may change over time, the maintenance cost would likely be high.

This doesn't prevent a Code::TidyAll plugin, but it's a trade-off vs implementing specific App::GitHooks plugins for each tool that Code::TidyAll supports.

2) Automatically running Code::TidyAll to clean up the files before they're committed.

This is a difficult problem, in particular because:

  1. This causes automatic modifications to local user changes that haven't been committed yet. If the code cleaning tools do something that is unexpected, reverting the automatic changes is going to be complicated and potentially confusing for the user.
  2. This would need to handle partial staged edits (with git add -p), and how to stage the corresponding parts of the automatic cleanup.

TidyAll::Git::Precommit does not offer this either, possibly for similar reasons.

from app-githooks.

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.