Skip to content

Script to create the Git pre-commit hook.#4622

Merged
schlessera merged 2 commits intowp-cli:masterfrom
tiagohillebrandt:master
Feb 19, 2018
Merged

Script to create the Git pre-commit hook.#4622
schlessera merged 2 commits intowp-cli:masterfrom
tiagohillebrandt:master

Conversation

@tiagohillebrandt
Copy link
Contributor

Creates a Git pre-commit file to run phpcs once every commit (#4474).

@gitlost
Copy link
Contributor

gitlost commented Jan 19, 2018

Thanks for the PR @tiagohillebrandt! Although marked for the 1.5.0 milestone, this issue isn't a priority at the moment so it may take a little while before your PR is reviewed.

@gitlost gitlost added the scope:testing Related to testing label Jan 19, 2018
Copy link
Member

@danielbachhuber danielbachhuber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks reasonable to me. I'd like to get a second pair of eyes though.

@danielbachhuber danielbachhuber requested a review from a team February 12, 2018 15:05
@schlessera
Copy link
Member

The immediate problem I see is that this always runs PHPCS over the entire codebase, not over the commit that was staged.

It would be preferable to only check the files or even only lines that are being modified, otherwise you might not be able to commit something due to unrelated problems.

@danielbachhuber
Copy link
Member

The immediate problem I see is that this always runs PHPCS over the entire codebase, not over the commit that was staged.

Isn't this what our existing code does? I don't think it's an optimization we need right now...

@schlessera
Copy link
Member

Yes, you're right. Let's just go with this and try how it plays out. There's nothing preventing us from changing it down the line in case it is problematic.

@schlessera schlessera merged commit 16a7d42 into wp-cli:master Feb 19, 2018
@schlessera schlessera added this to the 2.0.0 milestone Feb 19, 2018
@schlessera
Copy link
Member

schlessera commented Feb 19, 2018

Hmm, already regretting to have merged this with full check:

image 2018-02-19 at 8 54 57 pm

Takes 25.5 seconds on my system to produce an empty commit.

@danielbachhuber
Copy link
Member

Takes 25.5 seconds on my system to produce an empty commit.

Isn't this better than waiting for Travis to build, and then having to come back ground to it?

@schlessera
Copy link
Member

It just takes too much time. I'll add another PR to change this so it only checks files that were changed.

@gitlost
Copy link
Contributor

gitlost commented Feb 19, 2018

Isn't this better than waiting for Travis to build, and then having to come back ground to it?

No!

schlessera added a commit that referenced this pull request Feb 19, 2018
This avoids causing unnecessary delays when committing files.

See #4622 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope:testing Related to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants