Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Code::TidyAll support #39

Open
sjn opened this issue Jul 28, 2016 · 1 comment
Open

Feature request: Code::TidyAll support #39

sjn opened this issue Jul 28, 2016 · 1 comment

Comments

@sjn
Copy link

sjn commented Jul 28, 2016

Hei!

Would it be possible to add support for Code::TidyAll to App::GitHooks? (e.g. as a plugin?)

@sjn sjn changed the title Feature request: Code::TidyAll Feature request: Code::TidyAll support Jul 28, 2016
@guillaumeaubert
Copy link
Owner

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.

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

No branches or pull requests

2 participants