diff --git a/ContributionScores.i18n.magic.php b/ContributionScores.i18n.magic.php index 3c51119..8f15db3 100644 --- a/ContributionScores.i18n.magic.php +++ b/ContributionScores.i18n.magic.php @@ -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' ], +]; diff --git a/ContributionScores.php b/ContributionScores.php index 47ebc67..508e4d6 100644 --- a/ContributionScores.php +++ b/ContributionScores.php @@ -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 { diff --git a/ContributionScores_body.php b/ContributionScores_body.php index 4f4d309..aba2370 100644 --- a/ContributionScores_body.php +++ b/ContributionScores_body.php @@ -94,11 +94,11 @@ class ContributionScores extends IncludableSpecialPage { $output = "
{$title} | \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 ); diff --git a/Gruntfile.js b/Gruntfile.js index 1c93271..3bed33b 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -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: [ diff --git a/composer.json b/composer.json index 083767b..5d52161 100644 --- a/composer.json +++ b/composer.json @@ -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" diff --git a/package.json b/package.json index 407b969..611c585 100644 --- a/package.json +++ b/package.json @@ -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" } }