Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Experiences With Pre Commit Hooks

1,610 views

Published on

Slides from PHP Unconference 09 in Hamburg

Published in: Technology
  • Be the first to comment

Experiences With Pre Commit Hooks

  1. 1. PHP Unconference 09 Thomas Weinert Practical Experiences With Pre-Commit Hooks
  2. 2. About Me ● Application Developer – PHP – XSLT/XPath – Javascript ● papaya CMS – PHP based Content Management System – uses XSLT for Templates
  3. 3. SVN Hooks ● Shell scripts on server ● For each repository ● Several events – Pre-/Post-Commit
  4. 4. Pre-Commit ● Before Commit ● Transaction ● Standard error goes to SVN client ● Return value != 0 blocks commit
  5. 5. PHPCodeSniffer ● Ensure coding style ● Block parse errors (Lint) ● Ensure licence infos
  6. 6. Reaction ● Anger ● Acceptance ● Happyness ● Request for more sniffs – Rules that are not checked are ignored
  7. 7. SVNLook – On repository – Read only – Revision or transaction
  8. 8. papaya Custom Hook ● Calls PHPCodeSniffer only once ● Streamwrapper for SVNLook ● Uses XML response ● Outputs detailed error informations for each file ● Exclude: */external/*
  9. 9. Screenshot: Coding Style Error
  10. 10. Parse Error Sniff ● php -l ● ext/pcntl ● Input/output streams
  11. 11. Screenshot: Parse Error
  12. 12. Commit Message Check ● Kore Nordmann for Arbit(Tracker) ● Connect revision control system to bug tracker ● Readability ● Can not check contents
  13. 13. Screenshot: Bad Message
  14. 14. Rules ● - keyword (ticket): description ● # comment ● Maximum line length
  15. 15. Sample
  16. 16. Reactions ● Rejection and acceptance ● Syntax flame war ● Keyword flame war ● Line break flame war ● Increasing quality
  17. 17. Result ● Two additional keywords for documentation team ● Line break suggestions
  18. 18. Screenshot: Fisheye
  19. 19. Mantis ● 1.1 – Several commit hooks for actions in Mantis – Commits as comments ● 1.2 – Source browser plugin (WebSVN) – Connects change sets to tickets
  20. 20. Screenshot: Mantis 1.2

×