1 | <?php |
||
20 | class HubphCommands extends \Robo\Tasks implements ConfigAwareInterface, LoggerAwareInterface |
||
21 | { |
||
22 | use ConfigAwareTrait; |
||
23 | use LoggerAwareTrait; |
||
24 | |||
25 | /** |
||
26 | * Report who we have authenticated as |
||
27 | * |
||
28 | * @command whoami |
||
29 | */ |
||
30 | public function whoami($options = ['as' => 'default']) |
||
38 | |||
39 | /** |
||
40 | * @command pr:close |
||
41 | */ |
||
42 | public function prClose($projectWithOrg = '', $number = '', $options = ['as' => 'default']) |
||
54 | |||
55 | /* |
||
56 | * hubph pr:check --vid=php-7.0./31 --vid=php-7.1./20 |
||
57 | * |
||
58 | * status 0 and csv with PR numbers to close |
||
59 | * |
||
60 | * - or - |
||
61 | * |
||
62 | * status 1 if all vid/vvals exist and nothing more needs to be done |
||
63 | */ |
||
64 | |||
65 | /** |
||
66 | * @command pr:check |
||
67 | */ |
||
68 | public function prCheck( |
||
99 | |||
100 | /** |
||
101 | * @command pr:create |
||
102 | * @aliases pull-request |
||
103 | */ |
||
104 | public function prCreate( |
||
140 | |||
141 | protected function getMessage($options) |
||
151 | |||
152 | protected function getVids($options, $message) |
||
171 | |||
172 | protected function projectWithOrg($projectWithOrg = '') |
||
180 | |||
181 | protected function getProjectWithOrgFromRemote($remote = 'origin', $cwd = '') |
||
187 | |||
188 | protected function getProjectWithOrfFromUrl($remote) |
||
196 | |||
197 | protected function getRemote($remote = 'origin', $cwd = '') |
||
204 | |||
205 | /** |
||
206 | * @command pr:find |
||
207 | * @param $projectWithOrg The project to work on, e.g. org/project |
||
208 | * @option $q Query term |
||
209 | * @filter-output |
||
210 | * @field-labels |
||
211 | * url: Url |
||
212 | * id: ID |
||
213 | * node_id: Node ID |
||
214 | * html_url: HTML Url |
||
215 | * diff_url: Diff Url |
||
216 | * patch_url: Patch Url |
||
217 | * issue_url: Issue Url |
||
218 | * number: Number |
||
219 | * state: State |
||
220 | * locked: Locked |
||
221 | * title: Title |
||
222 | * user: User |
||
223 | * body: Boday |
||
224 | * created_at: Created |
||
225 | * updated_at: Updated |
||
226 | * closed_at: Closed |
||
227 | * merged_at: Merged |
||
228 | * merge_commit_sha: Merge Commit |
||
229 | * assignee: Assignee |
||
230 | * assignees: Assignees |
||
231 | * requested_reviewers: Requested Reviewers |
||
232 | * requested_teams: Requested Teams |
||
233 | * labels: Labels |
||
234 | * milestone: Milestone |
||
235 | * commits_url: Commit Url |
||
236 | * review_comments_url: Review Comments Url |
||
237 | * review_comment_url: Review Comment Url |
||
238 | * comments_url: Comments Url |
||
239 | * statuses_url: Statuses Url |
||
240 | * head: Head |
||
241 | * base: Base |
||
242 | * _links: Links |
||
243 | * @default-fields number,user,title |
||
244 | * @default-string-field number |
||
245 | * @return Consolidation\OutputFormatters\StructuredData\RowsOfFields |
||
246 | */ |
||
247 | public function prFind($projectWithOrg = '', $options = ['as' => 'default', 'format' => 'yaml', 'q' => '']) |
||
266 | |||
267 | /** |
||
268 | * @command pr:show |
||
269 | * @field-labels |
||
270 | * url: Url |
||
271 | * id: ID |
||
272 | * node_id: Node ID |
||
273 | * html_url: HTML Url |
||
274 | * diff_url: Diff Url |
||
275 | * patch_url: Patch Url |
||
276 | * issue_url: Issue Url |
||
277 | * number: Number |
||
278 | * state: State |
||
279 | * locked: Locked |
||
280 | * title: Title |
||
281 | * user: User |
||
282 | * body: Boday |
||
283 | * created_at: Created |
||
284 | * updated_at: Updated |
||
285 | * closed_at: Closed |
||
286 | * merged_at: Merged |
||
287 | * merge_commit_sha: Merge Commit |
||
288 | * assignee: Assignee |
||
289 | * assignees: Assignees |
||
290 | * requested_reviewers: Requested Reviewers |
||
291 | * requested_teams: Requested Teams |
||
292 | * labels: Labels |
||
293 | * milestone: Milestone |
||
294 | * commits_url: Commit Url |
||
295 | * review_comments_url: Review Comments Url |
||
296 | * review_comment_url: Review Comment Url |
||
297 | * comments_url: Comments Url |
||
298 | * statuses_url: Statuses Url |
||
299 | * head: Head |
||
300 | * base: Base |
||
301 | * _links: Links |
||
302 | * @return Consolidation\OutputFormatters\StructuredData\PropertyList |
||
303 | */ |
||
304 | public function prShow($projectWithOrg = '', $number = '', $options = ['as' => 'default', 'format' => 'table']) |
||
322 | |||
323 | /** |
||
324 | * @command pr:list |
||
325 | * @param $projectWithOrg The project to work on, e.g. org/project |
||
326 | * @filter-output |
||
327 | * @field-labels |
||
328 | * url: Url |
||
329 | * id: ID |
||
330 | * node_id: Node ID |
||
331 | * html_url: HTML Url |
||
332 | * diff_url: Diff Url |
||
333 | * patch_url: Patch Url |
||
334 | * issue_url: Issue Url |
||
335 | * number: Number |
||
336 | * state: State |
||
337 | * locked: Locked |
||
338 | * title: Title |
||
339 | * user: User |
||
340 | * body: Boday |
||
341 | * created_at: Created |
||
342 | * updated_at: Updated |
||
343 | * closed_at: Closed |
||
344 | * merged_at: Merged |
||
345 | * merge_commit_sha: Merge Commit |
||
346 | * assignee: Assignee |
||
347 | * assignees: Assignees |
||
348 | * requested_reviewers: Requested Reviewers |
||
349 | * requested_teams: Requested Teams |
||
350 | * labels: Labels |
||
351 | * milestone: Milestone |
||
352 | * commits_url: Commit Url |
||
353 | * review_comments_url: Review Comments Url |
||
354 | * review_comment_url: Review Comment Url |
||
355 | * comments_url: Comments Url |
||
356 | * statuses_url: Statuses Url |
||
357 | * head: Head |
||
358 | * base: Base |
||
359 | * _links: Links |
||
360 | * @default-fields number,user,title |
||
361 | * @default-string-field number |
||
362 | * @return Consolidation\OutputFormatters\StructuredData\RowsOfFields |
||
363 | */ |
||
364 | public function prList($projectWithOrg = '', $options = ['state' => 'open', 'as' => 'default', 'format' => 'table']) |
||
380 | |||
381 | protected function alterPRTables($data) |
||
409 | |||
410 | protected function keyById($data, $field) |
||
424 | |||
425 | /** |
||
426 | * @hook alter @filter-output |
||
427 | * @option $filter Filter output based on provided expression |
||
428 | * @default $filter '' |
||
429 | */ |
||
430 | public function filterOutput($result, CommandData $commandData) |
||
442 | |||
443 | protected function api($as = 'default') |
||
450 | } |
||
451 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.