Skip to content

Feature request: phpcbf-changed #109

@ockham

Description

@ockham

I have a project where phpcbf is run by a pre-commit hook. Since phpcbf can't be limited to parts of a file, the hook will always stage a file in its entirety for commit, if that file was touched by phpcbf at all.

OTOH, I like to use git add -p to only stage parts of files for commit (and leave other changes unstaged); this helps me organize changes into multiple commits, stash some changes for later use, or simply leave out debug statements (to be removed later by e.g. git checkout -- .). However, if I try to commit those select changes, what I'll get instead is the entire file being committed, due to the aforementioned pre-commit hook that runs phpcbf.

I was thinking that this problem could be solved by having a phpcbf-changed command akin to phpcs-changed, which only beautifies lines that have changed with respect to a base reference (in my example, only lines that are staged for commit).

Would it be possible to add such a command to this repo? 😊

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions