Skip to content

Commit 6b4d558

Browse files
authored
Merge pull request #35 from wp-cli/add/phpcs-file
2 parents 4686e6e + 2f03dc2 commit 6b4d558

13 files changed

+377
-271
lines changed

.maintenance/clone-all-repositories.php

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,18 @@
1212
'wp-cli-roadmap',
1313
);
1414

15-
$request = 'https://api.github.com/orgs/wp-cli/repos?per_page=100';
16-
$headers = '';
17-
$token = getenv( 'GITHUB_TOKEN' );
18-
if (!empty($token)) {
19-
$headers = '--header "Authorization: token $token"';
20-
$response = shell_exec( "curl -s {$headers} {$request}" );
15+
$request = 'https://api.github.com/orgs/wp-cli/repos?per_page=100';
16+
$headers = '';
17+
$token = getenv( 'GITHUB_TOKEN' );
18+
if ( ! empty( $token ) ) {
19+
$headers = '--header "Authorization: token $token"';
20+
$response = shell_exec( "curl -s {$headers} {$request}" );
21+
} else {
22+
$response = shell_exec( "curl -s {$request}" );
2123
}
22-
else
23-
{
24-
$response = shell_exec( "curl -s {$request}" );
25-
}
26-
$repositories = json_decode( $response );
24+
$repositories = json_decode( $response );
2725
if ( ! is_array( $repositories ) && property_exists( $repositories, 'message' ) ) {
28-
echo "GitHub responded with: " . $repositories->message . "\n";
26+
echo 'GitHub responded with: ' . $repositories->message . "\n";
2927
echo "If you are running into a rate limiting issue during large events please set GITHUB_TOKEN environment variable.\n";
3028
exit( 1 );
3129
}
@@ -40,9 +38,10 @@
4038

4139
if ( ! is_dir( $repository->name ) ) {
4240
printf( "Fetching \033[32mwp-cli/{$repository->name}\033[0m...\n" );
43-
system( "git clone {$repository->ssh_url}" );
41+
$clone_url = getenv( 'GITHUB_ACTION' ) ? $repository->clone_url : $repository->ssh_url;
42+
system( "git clone {$clone_url}" );
4443
}
45-
44+
4645
$update_folders[] = $repository->name;
4746
}
4847

.maintenance/phpstorm.exclude-recursive-folders.php

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?php
2+
3+
// phpcs:disable PEAR.NamingConventions.ValidClassName.StartWithCapital,PEAR.NamingConventions.ValidClassName.Invalid
24
/**
35
* phpstorm follows symlinks when indexing, which creates an infinite loop of indexing.
46
* The inclusion of the vendor folders is mostly the problem
57
*/
6-
78
class phpstorm_exclude_recursive_folders {
89

910
public static function init() {
@@ -74,7 +75,7 @@ protected static function has_project_iml() {
7475
*/
7576
protected static function get_project_name() {
7677
$pwd = getcwd();
77-
$project_name = substr( $pwd, strrpos( $pwd, "/" ) + 1 );
78+
$project_name = substr( $pwd, strrpos( $pwd, '/' ) + 1 );
7879

7980
return $project_name;
8081
}
@@ -87,8 +88,8 @@ protected static function get_project_iml_path() {
8788
$modules_xml = new DOMDocument();
8889
$modules_xml->load( '.idea/modules.xml' );
8990
$iml_file_path = $modules_xml->getElementsByTagName( 'component' )->item( 0 )
90-
->getElementsByTagName( 'modules' )->item( 0 )
91-
->getElementsByTagName( 'module' )->item( 0 )->getAttribute( 'filepath' );
91+
->getElementsByTagName( 'modules' )->item( 0 )
92+
->getElementsByTagName( 'module' )->item( 0 )->getAttribute( 'filepath' );
9293
$iml_file_path = str_replace( '$PROJECT_DIR$/', '', $iml_file_path );
9394

9495
return $iml_file_path;
@@ -120,13 +121,15 @@ protected static function get_exclude_dir_list() {
120121
* Add the folders to exclude in the iml file.
121122
*/
122123
protected static function set_exclude_in_project_iml() {
123-
$folders_to_exclude = self::get_exclude_dir_list();
124-
$iml_xml = new DOMDocument();
124+
$folders_to_exclude = self::get_exclude_dir_list();
125+
$iml_xml = new DOMDocument();
126+
// phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
125127
$iml_xml->preserveWhiteSpace = false;
126-
$iml_xml->formatOutput = true;
128+
// phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
129+
$iml_xml->formatOutput = true;
127130
$iml_xml->load( self::get_project_iml_path() );
128131
$iml_xml_content_node = $iml_xml->getElementsByTagName( 'component' )->item( 0 )
129-
->getElementsByTagName( 'content' )->item( 0 );
132+
->getElementsByTagName( 'content' )->item( 0 );
130133
$xpath = new DomXpath( $iml_xml );
131134

132135
foreach ( $folders_to_exclude as $folder ) {
@@ -144,8 +147,10 @@ protected static function set_exclude_in_project_iml() {
144147
$iml_xml_content_node->appendChild( $exclude_node );
145148
}
146149

150+
// phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
147151
$iml_xml->preserveWhiteSpace = false;
148-
$iml_xml->formatOutput = true;
152+
// phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
153+
$iml_xml->formatOutput = true;
149154
$iml_xml->save( self::get_project_iml_path() );
150155
}
151156
}

.maintenance/refresh-repository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?php
22

3-
if ( ! isset ( $argv[1] ) || ! is_dir( $argv[1] ) ) {
3+
if ( ! isset( $argv[1] ) || ! is_dir( $argv[1] ) ) {
44
exit( "Usage: php refresh-repository.php <repository-folder>\n" );
55
}
66

77
$repository = $argv[1];
8-
$path = realpath( getcwd() . "/{$repository}" );
8+
$path = realpath( getcwd() . "/{$repository}" );
99

1010
printf( "--- Refreshing repository \033[32m{$repository}\033[0m ---\n" );
1111

0 commit comments

Comments
 (0)