Paladox has uploaded a new change for review.
https://gerrit.wikimedia.org/r/243682
Change subject: Add php code sniffer
..
Add php code sniffer
Originly from siebrand ( https://gerrit.wikimedia.org/r/#/c/243160/ )
Bug: T90943
Change-Id: Ic7d101ca2b2be0592e0391f35ad9fe247eddfb12
---
M .gitignore
M .jshintignore
M .jshintrc
M composer.json
M messagegroups/FileBasedMessageGroup.php
A phpcs.xml
M scripts/plural-comparison.php
7 files changed, 38 insertions(+), 9 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate
refs/changes/82/243682/1
diff --git a/.gitignore b/.gitignore
index 115b5cd..4d4a120 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,7 @@
-.svn
+composer.lock
+extensions/
+node_modules/
+vendor/
*~
.*.swp
*.kate-swp
@@ -9,6 +12,3 @@
.settings
*.bak
tests/pagetranslation/*.fail
-composer.lock
-extensions/
-vendor/
diff --git a/.jshintignore b/.jshintignore
index 6fe22a3..d4bff2b 100644
--- a/.jshintignore
+++ b/.jshintignore
@@ -1,3 +1,8 @@
+extensions
+node_modules
+vendor
+
# upstream libs
+resources/js/jquery.ajaxdispatcher.js
resources/js/jquery.autosize.js
-resources/js/jquery.ui.position.js
+resources/js/jquery.textchange.js
diff --git a/.jshintrc b/.jshintrc
index d7649a3..ce29904 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -16,7 +16,7 @@
"bitwise": true,
"forin": false,
"regexp": false,
- "strict": true,
+ "strict": false,
"laxbreak": true,
"smarttabs": true,
"multistr": true,
diff --git a/composer.json b/composer.json
index 2a1da67..c1da9c1 100644
--- a/composer.json
+++ b/composer.json
@@ -23,7 +23,7 @@
},
{
"name": "Siebrand Mazeland",
- "email": "s.mazel...@xs4all.nl",
+ "email": "siebr...@kitano.nl",
"role": "Developer"
}
],
@@ -38,11 +38,21 @@
"composer/installers": ">=1.0.1",
"mediawiki/universal-language-selector": "*"
},
+ "require-dev": {
+ "jakub-onderka/php-parallel-lint": "0.9",
+ "mediawiki/mediawiki-codesniffer": "0.4.0"
+ },
"suggest": {
"mediawiki/babel": "Users can easily indicate their language
proficiency on their user page",
"mediawiki/translation-notifications": "Manage communication
with translators",
"mustangostang/spyc": "More recent version of the bundled spyc
library",
"romaricdrigon/metayaml": "If you want to validate message
group configurations",
"ruflin/elastica": "Support for translation memory and search
in ElasticSearch"
+ },
+ "scripts": {
+ "test": [
+ "parallel-lint . --exclude vendor",
+ "phpcs -p -s"
+ ]
}
}
diff --git a/messagegroups/FileBasedMessageGroup.php
b/messagegroups/FileBasedMessageGroup.php
index 0b5c383..a36dfd6 100644
--- a/messagegroups/FileBasedMessageGroup.php
+++ b/messagegroups/FileBasedMessageGroup.php
@@ -110,7 +110,9 @@
* @since 2014.02 Made public
*/
public function replaceVariables( $pattern, $code ) {
+ // @codingStandardsIgnoreStart Ignore
MediaWiki.NamingConventions.ValidGlobalName.wgPrefix
global $IP, $wgTranslateGroupRoot;
+ // @codingStandardsIgnoreEnd
$variables = array(
'%CODE%' => $this->mapCode( $code ),
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 000..d81a292
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,8 @@
+
+
+
+ .
+
+
+ vendor
+
diff --git a/scripts/plural-comparison.php b/scripts/plural-comparison.php
index dc41b98..4b6bcd5 100644
--- a/scripts/plural-comparison.php
+++ b/scripts/plural-comparison.php
@@ -13,8 +13,7 @@
if ( getenv( 'MW_INSTALL_PATH' ) !== false ) {
$IP = getenv( 'MW_INSTALL_PATH' );
} else {
- $dir = __DIR__;
- $IP = "$dir/../../..";
+ $IP = __DIR__ . "/../../..";
}
require_once "$IP/maintenance/Maintenance.php";
@@ -129,13 +128,18 @@
}
public function loadCLDR() {
+ // @codingStandardsIgnoreStart Ignore
MediaWiki.NamingConventions.ValidGlobalName.wgPrefix
global $IP;
+ // @codingStandardsIgnoreEnd
return $this->loadPluralFile( "$IP/languages/data/plurals.xml"
);
}
public function loadMediaWiki() {
+ // @codingStandardsIgnoreStart Ignore
MediaWiki.NamingConventions.ValidGlobalName.wgPrefix
global $IP;
+ // @codingStandardsIgnoreEnd
+
$rules = $this->loadPluralFile(
"$IP/languages/data/plurals.xml" );
$rulesMW = $this->loadPluralFile(