Umherirrender has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/355137 )

Change subject: Add phpcs and make pass
......................................................................

Add phpcs and make pass

Change-Id: I3a0756f5f804a3326c9446d19d6c05fb5f0bd664
---
M composer.json
M includes/providers/GerritExtDistProvider.php
M includes/providers/GithubExtDistProvider.php
M includes/specials/SpecialBaseDistributor.php
M maintenance/purgeCachedStats.php
A phpcs.xml
6 files changed, 21 insertions(+), 8 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ExtensionDistributor 
refs/changes/37/355137/1

diff --git a/composer.json b/composer.json
index 686b65b..b8f68fb 100644
--- a/composer.json
+++ b/composer.json
@@ -1,11 +1,14 @@
 {
        "require-dev": {
                "jakub-onderka/php-parallel-lint": "0.9.2",
-               "jakub-onderka/php-console-highlighter": "0.3.2"
+               "jakub-onderka/php-console-highlighter": "0.3.2",
+               "mediawiki/mediawiki-codesniffer": "0.7.2"
        },
        "scripts": {
+               "fix": "phpcbf",
                "test": [
-                       "parallel-lint . --exclude vendor"
+                       "parallel-lint . --exclude vendor",
+                       "phpcs -p -s"
                ]
        }
 }
diff --git a/includes/providers/GerritExtDistProvider.php 
b/includes/providers/GerritExtDistProvider.php
index d00fc7b..b2fdb31 100644
--- a/includes/providers/GerritExtDistProvider.php
+++ b/includes/providers/GerritExtDistProvider.php
@@ -56,7 +56,7 @@
                $url = $this->substituteUrlVariables( $this->apiUrl, $name );
                $info = $this->makeGerritApiRequest( $url );
                $branches = [];
-               foreach( $info as $branch ) {
+               foreach ( $info as $branch ) {
                        if ( strpos( $branch['ref'], 'refs/heads/' ) === 0 ) {
                                $name = substr( $branch['ref'], strlen( 
'refs/heads/' ) );
                                $branches[$name] = $branch['revision'];
diff --git a/includes/providers/GithubExtDistProvider.php 
b/includes/providers/GithubExtDistProvider.php
index 4929465..2d29970 100644
--- a/includes/providers/GithubExtDistProvider.php
+++ b/includes/providers/GithubExtDistProvider.php
@@ -68,7 +68,7 @@
 
                $info = wfObjectToArray( FormatJson::decode( $req->getContent() 
), true );
                $branches = [];
-               foreach( $info as $branch ) {
+               foreach ( $info as $branch ) {
                        $branches[$branch['name']] = $branch['commit']['sha1'];
                }
 
diff --git a/includes/specials/SpecialBaseDistributor.php 
b/includes/specials/SpecialBaseDistributor.php
index 1a176a0..ed4d96d 100644
--- a/includes/specials/SpecialBaseDistributor.php
+++ b/includes/specials/SpecialBaseDistributor.php
@@ -79,7 +79,8 @@
 
                if ( !$this->getProvider()->hasBranch( $name, $version ) ) {
                        // extdist-no-such-version-extensions, 
extdist-no-such-version-skins
-                       $this->getOutput()->addWikiMsg( $this->msgKey( 
'extdist-no-such-version-$TYPE' ), $name, $version );
+                       $this->getOutput()->addWikiMsg(
+                               $this->msgKey( 'extdist-no-such-version-$TYPE' 
), $name, $version );
                        return;
                }
 
@@ -277,7 +278,7 @@
        protected function doDownload( $extension, $version ) {
                global $wgExtensionAssetsPath;
 
-               if( !$this->getProvider()->hasBranch( $extension, $version ) ) {
+               if ( !$this->getProvider()->hasBranch( $extension, $version ) ) 
{
                        $this->getOutput()->addWikiMsg( 'extdist-tar-error' );
                        return;
                }
diff --git a/maintenance/purgeCachedStats.php b/maintenance/purgeCachedStats.php
index 24cc901..66ae79c 100644
--- a/maintenance/purgeCachedStats.php
+++ b/maintenance/purgeCachedStats.php
@@ -7,7 +7,7 @@
 } else {
        $IP = __DIR__ . '/../../..';
 }
-require_once( "$IP/maintenance/Maintenance.php" );
+require_once "$IP/maintenance/Maintenance.php";
 
 /**
  * @author Addshore
@@ -30,4 +30,4 @@
 }
 
 $maintClass = "ExtDistPurgeCachedStats";
-require_once( RUN_MAINTENANCE_IF_MAIN );
+require_once RUN_MAINTENANCE_IF_MAIN;
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 0000000..ede6c5d
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ruleset>
+       <rule ref="vendor/mediawiki/mediawiki-codesniffer/MediaWiki"/>
+       <file>.</file>
+       <arg name="extensions" value="php,php5,inc"/>
+       <arg name="encoding" value="utf8"/>
+       <exclude-pattern>vendor</exclude-pattern>
+       <exclude-pattern>node_modules</exclude-pattern>
+</ruleset>

-- 
To view, visit https://gerrit.wikimedia.org/r/355137
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3a0756f5f804a3326c9446d19d6c05fb5f0bd664
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ExtensionDistributor
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to