Updates for CodeSniffer and other tests

Change-Id: Ief70f6b82ed9c10d658eaeb980b0a4e780de9ac2
This commit is contained in:
Siebrand Mazeland 2016-02-17 15:57:15 +01:00
parent 627050be10
commit 66cf8c80f0
6 changed files with 32 additions and 28 deletions

View file

@ -3,9 +3,9 @@
* Magic words for extension.
*/
$magicWords = array();
$magicWords = [];
/** English (English) */
$magicWords['en'] = array(
'cscore' => array( 0, 'cscore' ),
);
$magicWords['en'] = [
'cscore' => [ 0, 'cscore' ],
];

View file

@ -9,14 +9,14 @@ if ( !defined( 'MEDIAWIKI' ) ) {
exit( 1 );
}
$wgExtensionCredits['specialpage'][] = array(
$wgExtensionCredits['specialpage'][] = [
'path' => __FILE__,
'name' => 'Contribution Scores',
'url' => 'https://www.mediawiki.org/wiki/Extension:Contribution_Scores',
'author' => 'Tim Laqua',
'descriptionmsg' => 'contributionscores-desc',
'version' => '1.23.0'
);
'version' => '1.25.0'
];
define( 'CONTRIBUTIONSCORES_MAXINCLUDELIMIT', 50 );
$wgContribScoreReports = null;
@ -67,19 +67,19 @@ function efContributionScores_Render( &$parser, $usertext, $metric = 'score' ) {
if ( $metric == 'score' ) {
$res = $dbr->select( 'revision',
'COUNT(DISTINCT rev_page)+SQRT(COUNT(rev_id)-COUNT(DISTINCT rev_page))*2 AS wiki_rank',
array( 'rev_user' => $user->getID() ) );
[ 'rev_user' => $user->getID() ] );
$row = $dbr->fetchObject( $res );
$output = $wgLang->formatNum( round( $row->wiki_rank, 0 ) );
} elseif ( $metric == 'changes' ) {
$res = $dbr->select( 'revision',
'COUNT(rev_id) AS rev_count',
array( 'rev_user' => $user->getID() ) );
[ 'rev_user' => $user->getID() ] );
$row = $dbr->fetchObject( $res );
$output = $wgLang->formatNum( $row->rev_count );
} elseif ( $metric == 'pages' ) {
$res = $dbr->select( 'revision',
'COUNT(DISTINCT rev_page) AS page_count',
array( 'rev_user' => $user->getID() ) );
[ 'rev_user' => $user->getID() ] );
$row = $dbr->fetchObject( $res );
$output = $wgLang->formatNum( $row->page_count );
} else {

View file

@ -94,11 +94,11 @@ class ContributionScores extends IncludableSpecialPage {
$output = "<table class=\"wikitable contributionscores plainlinks{$sortable}\" >\n" .
"<tr class='header'>\n" .
Html::element( 'th', array(), $this->msg( 'contributionscores-rank' )->text() ) .
Html::element( 'th', array(), $this->msg( 'contributionscores-score' )->text() ) .
Html::element( 'th', array(), $this->msg( 'contributionscores-pages' )->text() ) .
Html::element( 'th', array(), $this->msg( 'contributionscores-changes' )->text() ) .
Html::element( 'th', array(), $this->msg( 'contributionscores-username' )->text() );
Html::element( 'th', [], $this->msg( 'contributionscores-rank' )->text() ) .
Html::element( 'th', [], $this->msg( 'contributionscores-score' )->text() ) .
Html::element( 'th', [], $this->msg( 'contributionscores-pages' )->text() ) .
Html::element( 'th', [], $this->msg( 'contributionscores-changes' )->text() ) .
Html::element( 'th', [], $this->msg( 'contributionscores-username' )->text() );
$altrow = '';
$user_rank = 1;
@ -154,12 +154,12 @@ class ContributionScores extends IncludableSpecialPage {
if ( !empty( $title ) ) {
$output = Html::rawElement( 'table',
array(
[
'style' => 'border-spacing: 0; padding: 0',
'class' => 'contributionscores-wrapper',
'lang' => htmlspecialchars( $lang->getCode() ),
'dir' => $lang->getDir()
),
],
"\n" .
"<tr>\n" .
"<td style='padding: 0px;'>{$title}</td>\n" .
@ -223,7 +223,7 @@ class ContributionScores extends IncludableSpecialPage {
}
$reportTitle .= ' ' . $this->msg( 'contributionscores-top' )->numParams( $limit )->text();
$title = Xml::element( 'h4',
array( 'class' => 'contributionscores-title' ),
[ 'class' => 'contributionscores-title' ],
$reportTitle
) . "\n";
$this->getOutput()->addHTML( $this->genContributionScoreTable(
@ -241,11 +241,11 @@ class ContributionScores extends IncludableSpecialPage {
global $wgContribScoreReports;
if ( !is_array( $wgContribScoreReports ) ) {
$wgContribScoreReports = array(
array( 7, 50 ),
array( 30, 50 ),
array( 0, 50 )
);
$wgContribScoreReports = [
[ 7, 50 ],
[ 30, 50 ],
[ 0, 50 ]
];
}
$out = $this->getOutput();
@ -260,7 +260,7 @@ class ContributionScores extends IncludableSpecialPage {
}
$reportTitle .= ' ' . $this->msg( 'contributionscores-top' )->numParams( $revs )->text();
$title = Xml::element( 'h2',
array( 'class' => 'contributionscores-title' ),
[ 'class' => 'contributionscores-title' ],
$reportTitle
) . "\n";
$out->addHTML( $title );

View file

@ -1,5 +1,7 @@
/*jshint node:true */
module.exports = function ( grunt ) {
'use strict';
grunt.loadNpmTasks( 'grunt-contrib-jshint' );
grunt.loadNpmTasks( 'grunt-banana-checker' );
grunt.loadNpmTasks( 'grunt-jsonlint' );
@ -11,7 +13,7 @@ module.exports = function ( grunt ) {
]
},
banana: {
all: 'i18n/'
all: 'i18n'
},
jsonlint: {
all: [

View file

@ -1,9 +1,10 @@
{
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",
"mediawiki/mediawiki-codesniffer": "0.5.1"
"mediawiki/mediawiki-codesniffer": "0.6.0"
},
"scripts": {
"fix": "phpcbf",
"test": [
"parallel-lint . --exclude vendor",
"phpcs -p -s"

View file

@ -7,7 +7,8 @@
"grunt": "0.4.5",
"grunt-cli": "0.1.13",
"grunt-contrib-jshint": "0.11.3",
"grunt-banana-checker": "0.4.0",
"grunt-jsonlint": "1.0.7"
"grunt-jscs": "2.5.0",
"grunt-jsonlint": "1.0.7",
"grunt-banana-checker": "0.4.0"
}
}