Comments (1)
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:
- 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.
- 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)
- Clean up App::GitHooks::Utils::get_ticket_id() HOT 1
- Account for git-commit trimming trailing whitespace by default HOT 1
- Add .githooksrc file for App-GitHooks HOT 1
- Add support for pre-push commit hook HOT 1
- Enforce branch names
- Plugin for Perl::Lint
- Do not add relative paths to Perl include search path HOT 2
- Make a pre-receive-reject-binaries clone
- Add CLI options to inject just a list of plugins
- Allow requiring a minimum version of App::GitHooks in githooksrc file
- Allow requiring a minimum version of App::GitHooks plugins in githooksrc file
- Asynchronous service for events created by plugins
- Plugin to post release notes to Google Calendar HOT 1
- Update a date field in JIRA with the current date
- Broken handling of commits with "git mv" (Plugins) HOT 2
- Suggestion: allow git to "wrap" githooks
- Feature request: "enable" and "disable" phases and/or plugins
- Fails to run with git worktree's
- Add a note to the commit message if the pre-commit hook was skipped via GITHOOKS_SKIP / _DISABLE env var
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from app-githooks.