Skip to content

Commit

Permalink
Merge pull request #13 from samwilson/phpcs
Browse files Browse the repository at this point in the history
Use MediaWiki coding standards
  • Loading branch information
ofbeaton authored Jan 11, 2021
2 parents ea597cf + 891593e commit 3b1497b
Show file tree
Hide file tree
Showing 8 changed files with 462 additions and 689 deletions.
9 changes: 9 additions & 0 deletions .phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<ruleset name="Realnames">

<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki" />
<file>.</file>

<arg name="extensions" value="php"/>
<arg name="encoding" value="UTF-8"/>
</ruleset>
50 changes: 1 addition & 49 deletions Realnames.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,52 +28,4 @@
die( 'This file is a MediaWiki extension, it is not a valid entry point' );
}

// Mediawiki Special:Version data
$wgExtensionCredits['parserhook'][] = array(
'name' => 'Realnames',
'author' => array(
'[http://ofbeaton.com/ Finlay Beaton]',
'...',
),
'version' => '0.6.2',
'url' => 'http://www.mediawiki.org/wiki/Extension:Realnames',
'description' => 'Displays a user\'s real name everywhere',
);

// Extension default configuration, docs in README.md, overwrite in LocalSettings.php
$wgRealnamesLinkStyle = 'paren-reverse';
$wgRealnamesLinkStyleBlankName = 'standard';
$wgRealnamesLinkStyleSameName = 'standard';
$wgRealnamesBareStyle = false;
$wgRealnamesBareStyleBlankName = false;
$wgRealnamesBareStyleSameName = false;
$wgRealnamesBlank = false;
$wgRealnamesReplacements = array(
'title' => true,
'subtitle' => true,
'personnal' => true,
'body' => true,
);
// $1 link start
// $2 username
// $3 real name
// $4 link end
$wgRealnamesStyles = array(
'standard' => '$1$2$4',
'append' => '$1$2 [$3]$4',
'replace' => '$1$3$4',
'reverse' => '$1$3 [$2]$4',
'dash' => '$1$2 &ndash; $3$4',
'dash-reverse' => '$1$3$4 &ndash; $2',
'paren-append' => '$1$2 ($3)$4',
'paren-reverse' => '$1$3 ($2)$4',
);
$wgRealnamesSmart = array( 'same' => true );
// do not include the ':'
// this is a regexp so escaping may be required.
$wgRealnamesNamespaces = array();

// Mediawiki extension plugin
$wgAutoloadClasses['ExtRealnames'] = dirname( __FILE__ ) . '/Realnames.body.php';
$wgHooks['BeforePageDisplay'][] = 'ExtRealnames::hookBeforePageDisplay';
$wgHooks['PersonalUrls'][] = 'ExtRealnames::hookPersonalUrls';
wfLoadExtension( 'Realnames' );
44 changes: 14 additions & 30 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,24 @@
"name": "realnames Community",
"homepage": "https://github.com/ofbeaton/mediawiki-realnames/graphs/contributors"
}
],
],
"require": {
"php": ">=5.6.0"
"php": ">=7.0"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.4",
"jakub-onderka/php-parallel-lint": "^1.0",
"jakub-onderka/php-console-highlighter": "^0.4.0",
"ofbeaton/granite-php": "^6.0",
"mediawiki/mediawiki-codesniffer": "~24.0.0",
"php-parallel-lint/php-parallel-lint": "1.2.0",
"php-parallel-lint/php-console-highlighter": "0.5.0",
"mediawiki/mediawiki-codesniffer": "34.0.0",
"phpcompatibility/php-compatibility": "*",
"roave/security-advisories": "dev-master"
},
"scripts": {
"check": [
"parallel-lint . --exclude vendor",
"phpcs -p --standard=vendor/phpcompatibility/php-compatibility/PHPCompatibility --ignore=vendor --runtime-set testVersion 5.0- .",
"phpcs -p"
],
"fix": [
"phpcbf -p"
],
"check-tests": [
"parallel-lint . --exclude vendor",
"phpcs -p --standard=vendor/ofbeaton/granite-php/phpcs/granite-tests --ignore=vendor tests"
],
"fix-tests": [
"phpcbf -p --standard=vendor/ofbeaton/granite-php/phpcs/granite-tests --ignore=vendor tests"
],
"test": [
"@check"
]
},
"config": {
"bin-dir": "vbin"
}
"scripts": {
"test": [
"parallel-lint . --exclude vendor",
"phpcs -s ."
],
"fix": [
"phpcbf -p"
]
}
}
Loading

0 comments on commit 3b1497b

Please sign in to comment.