mediawiki/extensions/Favorites: main (log #1182066)

sourcepatches

This run took 10 seconds.

From 4eaf9240908d4a2c4b7de2e6d7705e21bf95c3fb Mon Sep 17 00:00:00 2001
From: libraryupgrader <tools.libraryupgrader@tools.wmflabs.org>
Date: Sun, 17 Mar 2024 17:49:59 +0000
Subject: [PATCH] build: Updating mediawiki/mediawiki-codesniffer to 43.0.0

The following sniffs are failing and were disabled:
* Generic.CodeAnalysis.AssignmentInCondition.Found

The following sniffs now pass and were enabled:
* MediaWiki.ControlStructures.AssignmentInControlStructures.AssignmentInControlStructures

Change-Id: I808aa70c652b8b3079836678efdc6b5440be33ca
---
 .phpcs.xml                                | 2 +-
 composer.json                             | 7 ++++++-
 includes/FavParser.php                    | 2 +-
 includes/FavoritelistEditor.php           | 6 +++---
 includes/specials/SpecialFavoritelist.php | 2 +-
 5 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/.phpcs.xml b/.phpcs.xml
index a28e37a..3a7ee9b 100644
--- a/.phpcs.xml
+++ b/.phpcs.xml
@@ -1,8 +1,8 @@
 <?xml version="1.0"?>
 <ruleset>
 	<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
+		<exclude name="Generic.CodeAnalysis.AssignmentInCondition.Found" />
 		<exclude name="Generic.Files.OneObjectStructurePerFile.MultipleFound" />
-		<exclude name="MediaWiki.ControlStructures.AssignmentInControlStructures.AssignmentInControlStructures" />
 		<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" />
 		<exclude name="MediaWiki.Usage.DbrQueryUsage.DbrQueryFound" />
 	</rule>
diff --git a/composer.json b/composer.json
index 3e7043f..06286b3 100644
--- a/composer.json
+++ b/composer.json
@@ -1,6 +1,6 @@
 {
 	"require-dev": {
-		"mediawiki/mediawiki-codesniffer": "41.0.0",
+		"mediawiki/mediawiki-codesniffer": "43.0.0",
 		"mediawiki/minus-x": "1.1.1",
 		"php-parallel-lint/php-console-highlighter": "1.0.0",
 		"php-parallel-lint/php-parallel-lint": "1.3.2"
@@ -16,5 +16,10 @@
 			"phpcbf"
 		],
 		"phpcs": "phpcs -sp --cache"
+	},
+	"config": {
+		"allow-plugins": {
+			"dealerdirect/phpcodesniffer-composer-installer": true
+		}
 	}
 }
diff --git a/includes/FavParser.php b/includes/FavParser.php
index ef2a916..e870392 100644
--- a/includes/FavParser.php
+++ b/includes/FavParser.php
@@ -102,7 +102,7 @@ class FavParser {
 		$titles = [];
 		$dbr = wfGetDB( DB_PRIMARY );
 		$uid = intval( $user->getId() );
-		list( $favoritelist, $page ) = $dbr->tableNamesN( 'favoritelist', 'page' );
+		[ $favoritelist, $page ] = $dbr->tableNamesN( 'favoritelist', 'page' );
 		$sql = "SELECT fl_namespace, fl_title, page_id, page_len, page_is_redirect
 			FROM {$favoritelist} LEFT JOIN {$page} ON ( fl_namespace = page_namespace
 			AND fl_title = page_title ) WHERE fl_user = {$uid}";
diff --git a/includes/FavoritelistEditor.php b/includes/FavoritelistEditor.php
index f73f37f..cdaf61a 100644
--- a/includes/FavoritelistEditor.php
+++ b/includes/FavoritelistEditor.php
@@ -211,7 +211,7 @@ class FavoritelistEditor {
 		$titles = [];
 		$dbr = wfGetDB( DB_PRIMARY );
 		$uid = intval( $user->getId() );
-		list( $favoritelist, $page ) = $dbr->tableNamesN( 'favoritelist', 'page' );
+		[ $favoritelist, $page ] = $dbr->tableNamesN( 'favoritelist', 'page' );
 		$sql = "SELECT fl_namespace, fl_title, page_id, page_len, page_is_redirect
 			FROM {$favoritelist} LEFT JOIN {$page} ON ( fl_namespace = page_namespace
 			AND fl_title = page_title ) WHERE fl_user = {$uid}";
@@ -318,7 +318,7 @@ class FavoritelistEditor {
 					]
 				);
 				$article = new Article( $title );
-				$hookContainer->run( 'UnfavoriteArticleComplete', [ &$user,&$article ] );
+				$hookContainer->run( 'UnfavoriteArticleComplete', [ &$user, &$article ] );
 			}
 		}
 	}
@@ -431,7 +431,7 @@ class FavoritelistEditor {
 		}
 
 		if ( $showlinks ) {
-		return Xml::check( 'titles[]', false, [ 'value' => $title->getPrefixedText() ] )
+			return Xml::check( 'titles[]', false, [ 'value' => $title->getPrefixedText() ] )
 			. $link . " (" . $wgLang->pipeList( $tools ) . ")" . "\n<br>";
 		} else {
 			return Xml::check( 'titles[]', false, [ 'value' => $title->getPrefixedText() ] )
diff --git a/includes/specials/SpecialFavoritelist.php b/includes/specials/SpecialFavoritelist.php
index 1180091..184f680 100644
--- a/includes/specials/SpecialFavoritelist.php
+++ b/includes/specials/SpecialFavoritelist.php
@@ -263,7 +263,7 @@ class ViewFavorites {
 		$titles = [];
 		$dbr = wfGetDB( DB_PRIMARY );
 		$uid = intval( $user->getId() );
-		list( $favoritelist, $page ) = $dbr->tableNamesN( 'favoritelist', 'page' );
+		[ $favoritelist, $page ] = $dbr->tableNamesN( 'favoritelist', 'page' );
 		$sql = "SELECT fl_namespace, fl_title, page_id, page_len, page_is_redirect
 			FROM {$favoritelist} LEFT JOIN {$page} ON ( fl_namespace = page_namespace
 			AND fl_title = page_title ) WHERE fl_user = {$uid}";
-- 
2.39.2

$ date
--- stdout ---
Sun Mar 17 17:49:52 UTC 2024

--- end ---
$ git clone file:///srv/git/mediawiki-extensions-Favorites.git repo --depth=1 -b master
--- stderr ---
Cloning into 'repo'...
--- stdout ---

--- end ---
$ git config user.name libraryupgrader
--- stdout ---

--- end ---
$ git config user.email tools.libraryupgrader@tools.wmflabs.org
--- stdout ---

--- end ---
$ git submodule update --init
--- stdout ---

--- end ---
$ grr init
--- stdout ---
Installed commit-msg hook.

--- end ---
$ git show-ref refs/heads/master
--- stdout ---
0458d3adf7339881fcddcefed236590ded1c8542 refs/heads/master

--- end ---
$ /usr/bin/npm audit --json
--- stdout ---
{
  "auditReportVersion": 2,
  "vulnerabilities": {},
  "metadata": {
    "vulnerabilities": {
      "info": 0,
      "low": 0,
      "moderate": 0,
      "high": 0,
      "critical": 0,
      "total": 0
    },
    "dependencies": {
      "prod": 1,
      "dev": 439,
      "optional": 0,
      "peer": 7,
      "peerOptional": 0,
      "total": 439
    }
  }
}

--- end ---
$ /usr/bin/composer install
--- stderr ---
No composer.lock file present. Updating dependencies to latest instead of installing from lock file. See https://getcomposer.org/install for more information.
Loading composer repositories with package information
Updating dependencies
Lock file operations: 19 installs, 0 updates, 0 removals
  - Locking composer/semver (3.3.2)
  - Locking composer/spdx-licenses (1.5.8)
  - Locking mediawiki/mediawiki-codesniffer (v41.0.0)
  - Locking mediawiki/minus-x (1.1.1)
  - Locking php-parallel-lint/php-console-color (v1.0.1)
  - Locking php-parallel-lint/php-console-highlighter (v1.0.0)
  - Locking php-parallel-lint/php-parallel-lint (v1.3.2)
  - Locking psr/container (2.0.2)
  - Locking squizlabs/php_codesniffer (3.7.2)
  - Locking symfony/console (v5.4.36)
  - Locking symfony/deprecation-contracts (v3.4.0)
  - Locking symfony/polyfill-ctype (v1.29.0)
  - Locking symfony/polyfill-intl-grapheme (v1.29.0)
  - Locking symfony/polyfill-intl-normalizer (v1.29.0)
  - Locking symfony/polyfill-mbstring (v1.29.0)
  - Locking symfony/polyfill-php73 (v1.29.0)
  - Locking symfony/polyfill-php80 (v1.29.0)
  - Locking symfony/service-contracts (v3.4.1)
  - Locking symfony/string (v6.4.4)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 19 installs, 0 updates, 0 removals
    0 [>---------------------------]    0 [->--------------------------]
  - Installing symfony/polyfill-php80 (v1.29.0): Extracting archive
  - Installing squizlabs/php_codesniffer (3.7.2): Extracting archive
  - Installing symfony/polyfill-mbstring (v1.29.0): Extracting archive
  - Installing composer/spdx-licenses (1.5.8): Extracting archive
  - Installing composer/semver (3.3.2): Extracting archive
  - Installing mediawiki/mediawiki-codesniffer (v41.0.0): Extracting archive
  - Installing symfony/polyfill-intl-normalizer (v1.29.0): Extracting archive
  - Installing symfony/polyfill-intl-grapheme (v1.29.0): Extracting archive
  - Installing symfony/polyfill-ctype (v1.29.0): Extracting archive
  - Installing symfony/string (v6.4.4): Extracting archive
  - Installing psr/container (2.0.2): Extracting archive
  - Installing symfony/service-contracts (v3.4.1): Extracting archive
  - Installing symfony/polyfill-php73 (v1.29.0): Extracting archive
  - Installing symfony/deprecation-contracts (v3.4.0): Extracting archive
  - Installing symfony/console (v5.4.36): Extracting archive
  - Installing mediawiki/minus-x (1.1.1): Extracting archive
  - Installing php-parallel-lint/php-console-color (v1.0.1): Extracting archive
  - Installing php-parallel-lint/php-console-highlighter (v1.0.0): Extracting archive
  - Installing php-parallel-lint/php-parallel-lint (v1.3.2): Extracting archive
  0/19 [>---------------------------]   0%
 18/19 [==========================>-]  94%
 19/19 [============================] 100%
4 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating autoload files
13 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
--- stdout ---

--- end ---
Upgrading c:mediawiki/mediawiki-codesniffer from 41.0.0 -> 43.0.0
$ /usr/bin/composer update
--- stderr ---
Loading composer repositories with package information
Updating dependencies
Lock file operations: 3 installs, 3 updates, 0 removals
  - Upgrading composer/semver (3.3.2 => 3.4.0)
  - Locking dealerdirect/phpcodesniffer-composer-installer (v1.0.0)
  - Upgrading mediawiki/mediawiki-codesniffer (v41.0.0 => v43.0.0)
  - Locking phpcsstandards/phpcsextra (1.1.2)
  - Locking phpcsstandards/phpcsutils (1.0.9)
  - Upgrading squizlabs/php_codesniffer (3.7.2 => 3.8.1)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 3 installs, 3 updates, 0 removals
    0 [>---------------------------]    0 [->--------------------------]
  - Upgrading squizlabs/php_codesniffer (3.7.2 => 3.8.1): Extracting archive
  - Installing dealerdirect/phpcodesniffer-composer-installer (v1.0.0): Extracting archive
  - Installing phpcsstandards/phpcsutils (1.0.9): Extracting archive
  - Installing phpcsstandards/phpcsextra (1.1.2): Extracting archive
  - Upgrading composer/semver (3.3.2 => 3.4.0): Extracting archive
  - Upgrading mediawiki/mediawiki-codesniffer (v41.0.0 => v43.0.0): Extracting archive
 0/4 [>---------------------------]   0%
 4/4 [============================] 100%
Generating autoload files
14 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found
--- stdout ---
PHP CodeSniffer Config installed_paths set to ../../mediawiki/mediawiki-codesniffer,../../phpcsstandards/phpcsextra,../../phpcsstandards/phpcsutils

--- end ---
{'MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment', 'MediaWiki.ControlStructures.AssignmentInControlStructures.AssignmentInControlStructures', 'MediaWiki.Usage.DbrQueryUsage.DbrQueryFound', 'Generic.Files.OneObjectStructurePerFile.MultipleFound'}
Tests fail!
$ vendor/bin/phpcbf
--- stdout ---

PHPCBF RESULT SUMMARY
------------------------------------------------------------------------
FILE                                                    FIXED  REMAINING
------------------------------------------------------------------------
/src/repo/includes/FavParser.php                        1      2
/src/repo/includes/specials/SpecialFavoritelist.php     1      5
/src/repo/includes/FavoritelistEditor.php               3      4
------------------------------------------------------------------------
A TOTAL OF 5 ERRORS WERE FIXED IN 3 FILES
------------------------------------------------------------------------

Time: 286ms; Memory: 6MB



--- end ---
$ git checkout .phpcs.xml
--- stderr ---
Updated 1 path from the index
--- stdout ---

--- end ---
$ /usr/bin/composer install
--- stderr ---
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Nothing to install, update or remove
Generating autoload files
14 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
--- stdout ---

--- end ---
$ /usr/bin/composer test
--- stderr ---
> parallel-lint . --exclude vendor --exclude node_modules
> minus-x check .
> phpcs -sp --cache
--- stdout ---
PHP 8.2.7 | 10 parallel jobs
..........                                                   10/10 (100 %)


Checked 10 files in 0.1 seconds
No syntax error found
MinusX
======
Processing /src/repo...
...............................
All good!
.......... 10 / 10 (100%)


Time: 108ms; Memory: 8MB


--- end ---
$ /usr/bin/npm audit --json
--- stdout ---
{
  "auditReportVersion": 2,
  "vulnerabilities": {},
  "metadata": {
    "vulnerabilities": {
      "info": 0,
      "low": 0,
      "moderate": 0,
      "high": 0,
      "critical": 0,
      "total": 0
    },
    "dependencies": {
      "prod": 1,
      "dev": 439,
      "optional": 0,
      "peer": 7,
      "peerOptional": 0,
      "total": 439
    }
  }
}

--- end ---
$ package-lock-lint package-lock.json
--- stdout ---
Checking package-lock.json

--- end ---
build: Updating mediawiki/mediawiki-codesniffer to 43.0.0

The following sniffs are failing and were disabled:
* Generic.CodeAnalysis.AssignmentInCondition.Found

The following sniffs now pass and were enabled:
* MediaWiki.ControlStructures.AssignmentInControlStructures.AssignmentInControlStructures

$ git add .
--- stdout ---

--- end ---
$ git commit -F /tmp/tmpal69p13k
--- stdout ---
[master 4eaf924] build: Updating mediawiki/mediawiki-codesniffer to 43.0.0
 5 files changed, 12 insertions(+), 7 deletions(-)

--- end ---
$ git format-patch HEAD~1 --stdout
--- stdout ---
From 4eaf9240908d4a2c4b7de2e6d7705e21bf95c3fb Mon Sep 17 00:00:00 2001
From: libraryupgrader <tools.libraryupgrader@tools.wmflabs.org>
Date: Sun, 17 Mar 2024 17:49:59 +0000
Subject: [PATCH] build: Updating mediawiki/mediawiki-codesniffer to 43.0.0

The following sniffs are failing and were disabled:
* Generic.CodeAnalysis.AssignmentInCondition.Found

The following sniffs now pass and were enabled:
* MediaWiki.ControlStructures.AssignmentInControlStructures.AssignmentInControlStructures

Change-Id: I808aa70c652b8b3079836678efdc6b5440be33ca
---
 .phpcs.xml                                | 2 +-
 composer.json                             | 7 ++++++-
 includes/FavParser.php                    | 2 +-
 includes/FavoritelistEditor.php           | 6 +++---
 includes/specials/SpecialFavoritelist.php | 2 +-
 5 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/.phpcs.xml b/.phpcs.xml
index a28e37a..3a7ee9b 100644
--- a/.phpcs.xml
+++ b/.phpcs.xml
@@ -1,8 +1,8 @@
 <?xml version="1.0"?>
 <ruleset>
 	<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
+		<exclude name="Generic.CodeAnalysis.AssignmentInCondition.Found" />
 		<exclude name="Generic.Files.OneObjectStructurePerFile.MultipleFound" />
-		<exclude name="MediaWiki.ControlStructures.AssignmentInControlStructures.AssignmentInControlStructures" />
 		<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" />
 		<exclude name="MediaWiki.Usage.DbrQueryUsage.DbrQueryFound" />
 	</rule>
diff --git a/composer.json b/composer.json
index 3e7043f..06286b3 100644
--- a/composer.json
+++ b/composer.json
@@ -1,6 +1,6 @@
 {
 	"require-dev": {
-		"mediawiki/mediawiki-codesniffer": "41.0.0",
+		"mediawiki/mediawiki-codesniffer": "43.0.0",
 		"mediawiki/minus-x": "1.1.1",
 		"php-parallel-lint/php-console-highlighter": "1.0.0",
 		"php-parallel-lint/php-parallel-lint": "1.3.2"
@@ -16,5 +16,10 @@
 			"phpcbf"
 		],
 		"phpcs": "phpcs -sp --cache"
+	},
+	"config": {
+		"allow-plugins": {
+			"dealerdirect/phpcodesniffer-composer-installer": true
+		}
 	}
 }
diff --git a/includes/FavParser.php b/includes/FavParser.php
index ef2a916..e870392 100644
--- a/includes/FavParser.php
+++ b/includes/FavParser.php
@@ -102,7 +102,7 @@ class FavParser {
 		$titles = [];
 		$dbr = wfGetDB( DB_PRIMARY );
 		$uid = intval( $user->getId() );
-		list( $favoritelist, $page ) = $dbr->tableNamesN( 'favoritelist', 'page' );
+		[ $favoritelist, $page ] = $dbr->tableNamesN( 'favoritelist', 'page' );
 		$sql = "SELECT fl_namespace, fl_title, page_id, page_len, page_is_redirect
 			FROM {$favoritelist} LEFT JOIN {$page} ON ( fl_namespace = page_namespace
 			AND fl_title = page_title ) WHERE fl_user = {$uid}";
diff --git a/includes/FavoritelistEditor.php b/includes/FavoritelistEditor.php
index f73f37f..cdaf61a 100644
--- a/includes/FavoritelistEditor.php
+++ b/includes/FavoritelistEditor.php
@@ -211,7 +211,7 @@ class FavoritelistEditor {
 		$titles = [];
 		$dbr = wfGetDB( DB_PRIMARY );
 		$uid = intval( $user->getId() );
-		list( $favoritelist, $page ) = $dbr->tableNamesN( 'favoritelist', 'page' );
+		[ $favoritelist, $page ] = $dbr->tableNamesN( 'favoritelist', 'page' );
 		$sql = "SELECT fl_namespace, fl_title, page_id, page_len, page_is_redirect
 			FROM {$favoritelist} LEFT JOIN {$page} ON ( fl_namespace = page_namespace
 			AND fl_title = page_title ) WHERE fl_user = {$uid}";
@@ -318,7 +318,7 @@ class FavoritelistEditor {
 					]
 				);
 				$article = new Article( $title );
-				$hookContainer->run( 'UnfavoriteArticleComplete', [ &$user,&$article ] );
+				$hookContainer->run( 'UnfavoriteArticleComplete', [ &$user, &$article ] );
 			}
 		}
 	}
@@ -431,7 +431,7 @@ class FavoritelistEditor {
 		}
 
 		if ( $showlinks ) {
-		return Xml::check( 'titles[]', false, [ 'value' => $title->getPrefixedText() ] )
+			return Xml::check( 'titles[]', false, [ 'value' => $title->getPrefixedText() ] )
 			. $link . " (" . $wgLang->pipeList( $tools ) . ")" . "\n<br>";
 		} else {
 			return Xml::check( 'titles[]', false, [ 'value' => $title->getPrefixedText() ] )
diff --git a/includes/specials/SpecialFavoritelist.php b/includes/specials/SpecialFavoritelist.php
index 1180091..184f680 100644
--- a/includes/specials/SpecialFavoritelist.php
+++ b/includes/specials/SpecialFavoritelist.php
@@ -263,7 +263,7 @@ class ViewFavorites {
 		$titles = [];
 		$dbr = wfGetDB( DB_PRIMARY );
 		$uid = intval( $user->getId() );
-		list( $favoritelist, $page ) = $dbr->tableNamesN( 'favoritelist', 'page' );
+		[ $favoritelist, $page ] = $dbr->tableNamesN( 'favoritelist', 'page' );
 		$sql = "SELECT fl_namespace, fl_title, page_id, page_len, page_is_redirect
 			FROM {$favoritelist} LEFT JOIN {$page} ON ( fl_namespace = page_namespace
 			AND fl_title = page_title ) WHERE fl_user = {$uid}";
-- 
2.39.2


--- end ---
Source code is licensed under the AGPL.