Index: trunk/tools/subversion/hooks/HooksCommon.inc |
— | — | @@ -50,16 +50,18 @@ |
51 | 51 | /** |
52 | 52 | * Class constructor |
53 | 53 | * |
54 | | - * @param $repository String name of repository |
55 | | - * @param $transaction |
56 | | - */ |
57 | | - public function __construct( $repo, $txn ) { |
58 | | - $this->repo = $repo; |
59 | | - $this->transaction = $txn; |
60 | | - } |
| 54 | + * @param $repo String name of repository |
| 55 | + * @param txn |
| 56 | + */ |
| 57 | + public function __construct( $repo, $txn ) { |
| 58 | + $this->repo = $repo; |
| 59 | + $this->transaction = $txn; |
| 60 | + } |
61 | 61 | |
62 | | - /** |
| 62 | + /** |
63 | 63 | * Run SVN pre-commit tests |
| 64 | + * |
| 65 | + * @return int |
64 | 66 | */ |
65 | 67 | public function runPreCommitTests() { |
66 | 68 | $result = 0; |
— | — | @@ -78,17 +80,17 @@ |
79 | 81 | return $result; |
80 | 82 | } |
81 | 83 | |
82 | | - /** |
83 | | - * Get commit log message |
84 | | - * |
85 | | - * @return string |
86 | | - */ |
87 | | - private function getLogMessage() { |
88 | | - $output = null; |
89 | | - $cmd = "{$this->svnlook} log -t '{$this->transaction}' '{$this->repo}'"; |
90 | | - exec( $cmd, $output ); |
91 | | - return implode( $output ); |
92 | | - } |
| 84 | + /** |
| 85 | + * Get commit log message |
| 86 | + * |
| 87 | + * @return string |
| 88 | + */ |
| 89 | + private function getLogMessage() { |
| 90 | + $output = null; |
| 91 | + $cmd = "{$this->svnlook} log -t '{$this->transaction}' '{$this->repo}'"; |
| 92 | + exec( $cmd, $output ); |
| 93 | + return implode( $output ); |
| 94 | + } |
93 | 95 | |
94 | 96 | /** |
95 | 97 | * Get commit files list |
— | — | @@ -105,10 +107,10 @@ |
106 | 108 | $pos = strpos( $item, ' ' ); |
107 | 109 | $status = substr( $item, 0, $pos ); |
108 | 110 | $file = trim( substr( $item, $pos ) ); |
109 | | - $list[$file] = $status; |
110 | | - } |
111 | | - return $list; |
112 | | - } |
| 111 | + $list[$file] = $status; |
| 112 | + } |
| 113 | + return $list; |
| 114 | + } |
113 | 115 | |
114 | 116 | /** |
115 | 117 | * Get array of modified and added files |
— | — | @@ -140,7 +142,9 @@ |
141 | 143 | /** |
142 | 144 | * Check if log message validates length rules |
143 | 145 | * |
144 | | - * @param int $minlength minimum length of log message |
| 146 | + * @param $minLength int minimum length of log message |
| 147 | + * @param $regex string |
| 148 | + * |
145 | 149 | * @return bool |
146 | 150 | */ |
147 | 151 | protected function testLogMessageLength( $minLength = 1, $regex = '' ) { |
— | — | @@ -150,7 +154,7 @@ |
151 | 155 | if ( $minLength <= 1 ) { |
152 | 156 | return "Log message should not be empty. Please specify descriptive log message."; |
153 | 157 | } else { |
154 | | - return "You log message is too short ($length). It should be at least $minlength characters long."; |
| 158 | + return "You log message is too short ($length). It should be at least $minLength characters long."; |
155 | 159 | } |
156 | 160 | } elseif( !preg_match( "/$regex/i", $msg ) ) { |
157 | 161 | return "Please provide a descriptive commit message with letters."; |
— | — | @@ -158,6 +162,10 @@ |
159 | 163 | return true; |
160 | 164 | } |
161 | 165 | |
| 166 | + /** |
| 167 | + * @param $fileTypes array |
| 168 | + * @return bool|string |
| 169 | + */ |
162 | 170 | protected function testPHPLint( $fileTypes ) { |
163 | 171 | $output = null; |
164 | 172 | $result = ''; |