Umherirrender has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/358573 )
Change subject: Make some excludes sniff pass ...................................................................... Make some excludes sniff pass Long lines will be break in follow ups Change-Id: I3f696aaa29b6540cb0655f3f27364429cdc9d1f6 --- M composer.json M includes/Handlers/Forms/MetadataMappingHandler.php M includes/Handlers/Xml/XmlMappingHandler.php M includes/Models/MediawikiTemplate.php M phpcs.xml M tests/phpunit/UtilsTest.php 6 files changed, 50 insertions(+), 60 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GWToolset refs/changes/73/358573/1 diff --git a/composer.json b/composer.json index 3e676f3..e3e4a41 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ }, "scripts": { "test": [ - "parallel-lint . --exclude vendor", + "parallel-lint . --exclude vendor --exclude node_modules", "phpcs -p -s" ], "fix": [ diff --git a/includes/Handlers/Forms/MetadataMappingHandler.php b/includes/Handlers/Forms/MetadataMappingHandler.php index 84a509f..58e02e8 100644 --- a/includes/Handlers/Forms/MetadataMappingHandler.php +++ b/includes/Handlers/Forms/MetadataMappingHandler.php @@ -463,7 +463,6 @@ // began with // * $user_options['gwtoolset-record-current'] is the next record that needs to be // processed - // // example to illustrate the test // * Config::$preview_throttle = 3 // * $user_options['gwtoolset-mediafile-throttle'] = 10 @@ -472,7 +471,6 @@ // * $user_options['gwtoolset-record-current'] = 14 ( 13 mediafiles will have been // processed this is the current // record we need to process ) - // // the test 14 >= ( 4 + 10 ) is true so // * $user_options['gwtoolset-record-begin'] = $user_options['gwtoolset-record-current'] // * create another UploadMetadataJob that will take care of the last record diff --git a/includes/Handlers/Xml/XmlMappingHandler.php b/includes/Handlers/Xml/XmlMappingHandler.php index 229ec24..1d5901d 100644 --- a/includes/Handlers/Xml/XmlMappingHandler.php +++ b/includes/Handlers/Xml/XmlMappingHandler.php @@ -179,7 +179,6 @@ // can exist. some may have a lang attribute and some may not. if the first element // found does not have a lang attribute it is stored as a value in // $elements_mapped[$template_parameter] and consecutive elements are concatenate on it. - // // however, if one of those similar elements has a lang attribute, // $elements_mapped[$template_parameter] needs to become an array with index [0] // containing the values that do not have a lang attribute and index['language'] @@ -236,7 +235,6 @@ // if a template_parameter has some elements with a lang attribute // and some not, the non lang attribute versions need their own // array element - // // isset( $elements_mapped[ $template_parameter ][ 'language ] ) // doesn't work here if ( is_array( $elements_mapped[$template_parameter] ) diff --git a/includes/Models/MediawikiTemplate.php b/includes/Models/MediawikiTemplate.php index 8f65dc7..54f0887 100644 --- a/includes/Models/MediawikiTemplate.php +++ b/includes/Models/MediawikiTemplate.php @@ -374,12 +374,10 @@ // sometimes a metadata element has an XML attribute that the tools // looks for in order to possibly place the metadata into a // sub-template, e.g., <dc:description lang="en"> - // // currently the application only looks for XML elements with the // attribute lang; those elements are placed into an associative array // 'language' and are processed here. no other array grouping is // currently created. - // // this section is meant to handle this current scenario and any future // scenarios of this type. if ( is_array( $content ) ) { @@ -387,10 +385,10 @@ if ( $sub_template_name === 'language' ) { foreach ( $sub_template_content as $language => $language_content ) { $sections .= sprintf( - $this->_sub_templates['language'], - Utils::sanitizeString( $language ), - Utils::sanitizeString( $language_content ) - ) . PHP_EOL; + $this->_sub_templates['language'], + Utils::sanitizeString( $language ), + Utils::sanitizeString( $language_content ) + ) . PHP_EOL; } // sometimes there is more than one metadata element with the same diff --git a/phpcs.xml b/phpcs.xml index 8fee2e0..9aa9780 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -2,15 +2,11 @@ <ruleset> <rule ref="vendor/mediawiki/mediawiki-codesniffer/MediaWiki"> <exclude name="Generic.Files.LineLength"/> - <exclude name="Generic.Functions.OpeningFunctionBraceKernighanRitchie.ContentAfterBrace"/> - <exclude name="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed"/> - <exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.EmptyComment"/> - <exclude name="MediaWiki.WhiteSpace.SpaceyParenthesis.SingleSpaceAfterOpenParenthesis"/> - <exclude name="MediaWiki.WhiteSpace.SpaceyParenthesis.SingleSpaceBeforeCloseParenthesis"/> <exclude name="PSR2.Classes.PropertyDeclaration.Underscore"/> </rule> <file>.</file> - <arg name="encoding" value="utf8"/> + <arg name="encoding" value="UTF-8"/> <arg name="extensions" value="php,php5,inc"/> <exclude-pattern>vendor</exclude-pattern> + <exclude-pattern>node_modules</exclude-pattern> </ruleset> diff --git a/tests/phpunit/UtilsTest.php b/tests/phpunit/UtilsTest.php index f0bfb9c..a6fd516 100644 --- a/tests/phpunit/UtilsTest.php +++ b/tests/phpunit/UtilsTest.php @@ -20,78 +20,78 @@ parent::tearDown(); } - /** - * @covers Utils::getArraySecondLevelValues - */ + /** + * @covers Utils::getArraySecondLevelValues + */ public function test_getArraySecondLevelValues_empty() { - $input = [[]]; + $input = [ [] ]; $expected = []; - $this->assertEquals( $this->utils->getArraySecondLevelValues($input), $expected); + $this->assertEquals( $this->utils->getArraySecondLevelValues( $input ), $expected ); } - /** - * @covers Utils::getArraySecondLevelValues - */ + /** + * @covers Utils::getArraySecondLevelValues + */ public function test_getArraySecondLevelValues() { - $input = [ [1], [2], [3,4,5] ]; - $expected = [1, 2, 3, 4, 5]; - $this->assertEquals( $this->utils->getArraySecondLevelValues($input), $expected); + $input = [ [ 1 ], [ 2 ], [ 3, 4, 5 ] ]; + $expected = [ 1, 2, 3, 4, 5 ]; + $this->assertEquals( $this->utils->getArraySecondLevelValues( $input ), $expected ); } - /** - * @covers Utils::getBytes - */ + /** + * @covers Utils::getBytes + */ public function test_getBytes_passthrough() { - $this->assertEquals( $this->utils->getBytes('1'), 1 ); + $this->assertEquals( $this->utils->getBytes( '1' ), 1 ); } - /** - * @covers Utils::getBytes - */ + /** + * @covers Utils::getBytes + */ public function test_getBytes_M() { - $this->assertEquals( $this->utils->getBytes("1M"), 1048576 ); + $this->assertEquals( $this->utils->getBytes( "1M" ), 1048576 ); } - /** - * @covers Utils::getBytes - */ - public function test_getBytes_K() {; - $this->assertEquals( $this->utils->getBytes("1K"), 1024 ); + /** + * @covers Utils::getBytes + */ + public function test_getBytes_K() { + $this->assertEquals( $this->utils->getBytes( "1K" ), 1024 ); } - /** - * @covers Utils::getBytes - */ + /** + * @covers Utils::getBytes + */ public function test_getBytes_G() { - $this->assertEquals( $this->utils->getBytes("1G"), 1073741824 ); + $this->assertEquals( $this->utils->getBytes( "1G" ), 1073741824 ); } - /** - * @covers Utils::getNamespaceName - */ + /** + * @covers Utils::getNamespaceName + */ public function test_getNamespaceName_empty() { $this->assertEquals( $this->utils->getNamespaceName(), ':' ); } - /** - * @covers Utils::getNamespaceName - */ + /** + * @covers Utils::getNamespaceName + */ public function test_getNamespaceName_6() { - $this->assertEquals( $this->utils->getNamespaceName(6), 'File:' ); + $this->assertEquals( $this->utils->getNamespaceName( 6 ), 'File:' ); } - /** - * @covers Utils::getNamespaceName - */ + /** + * @covers Utils::getNamespaceName + */ public function test_getNamespaceName_not_string() { - $this->assertEquals( $this->utils->getNamespaceName("Something"), null); + $this->assertEquals( $this->utils->getNamespaceName( "Something" ), null ); } - /** - * @covers Utils::normalizeSpace - */ + /** + * @covers Utils::normalizeSpace + */ public function test_normalizeSpace() { - $this->assertEquals( $this->utils->normalizeSpace("a b cd"), "a_b_cd"); + $this->assertEquals( $this->utils->normalizeSpace( "a b cd" ), "a_b_cd" ); } } -- To view, visit https://gerrit.wikimedia.org/r/358573 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3f696aaa29b6540cb0655f3f27364429cdc9d1f6 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/GWToolset Gerrit-Branch: master Gerrit-Owner: Umherirrender <umherirrender_de...@web.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits