Code standard check at the time of git commit

Events happening in the community are now at Drupal community events on www.drupal.org.
Posted by fotuzlab on May 10, 2012 at 11:39am

Was wondering if we could include pre-commit git hooks in module/theme repositories to check drupal coding standards. (Like the ones provided by http://drupal.org/project/git_hooks).
This would help in standardizing the code on d.o

The only problem I find is ... new contributors may find it irritating and hence put them off.

Thoughts???

Comments

Moving this question from the

Posted by webchick on May 10, 2012 at 3:20pm

Moving this question from the Drupal Association group to the Drupal.org improvements and Drupal.org Git Team groups.

Thanx. My bad! Didn't know

Posted by fotuzlab on May 10, 2012 at 3:30pm

Thanx. My bad! Didn't know Drupal.org Improvements exist.

Setup

Posted by helmo on May 11, 2012 at 6:26am

Pre-commit hooks need to be setup in everybody's own environment. So that would not scale.

And as you mention we don't want make it harder to contribute.

I think I would prefer a post-receive hook that kicks off a few test.
Giving a gentle hint about code style would be helpful in my opinion.

Why not integrate that with the "Automated testing" tab we already have?

"Pre-commit hooks need to be

Posted by fotuzlab on May 11, 2012 at 6:58am

"Pre-commit hooks need to be setup in everybody's own environment. So that would not scale."

Thats right! I was hoping if we could just clone these hooks at the time of checkout.

Nonetheless, adding a post receive hook sounds better. Send it as an email?

There is a problem with tests

Posted by aspilicious on May 14, 2012 at 12:47pm

There is a problem with tests and files from external libraries.
Sometimes they contain tabs and other problems on purpose.

Maybe we can add a special suffix to a patch to overcome that problem.
For example we could end those patches with -has-known-formatting-issues.

thisIsApatch-has-known-formatting-issues.patch

Sounds stupid but I think thats the best we can do. Or are there better options?

EDIT: on local commits this can lead to potential problems...

Drupal.org Improvements

Group categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

AltStyle によって変換されたページ (->オリジナル) /