-
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
phpcs: enable: Generic.Files.LineLength.TooLong
#150
Conversation
Check commit and GitHub actions for more details
Codecov Report
@@ Coverage Diff @@
## master #150 +/- ##
===========================================
- Coverage 8.50% 8.47% -0.04%
Complexity 1558 1558
===========================================
Files 22 22
Lines 4326 4343 +17
===========================================
Hits 368 368
- Misses 3958 3975 +17
Continue to review full report at Codecov.
|
if ( Config::getSetting( 'runFromProtectedPagesOnly' ) === true && $title && !$restrictionStore->isProtected( $title, 'edit' ) ) { | ||
// Ideally we would like to allow using a DPL query if the query istelf is coded on a template page which is protected. Then there would be no need for the article to be protected. However, how can one find out from which wiki source an extension has been invoked??? | ||
if ( | ||
Config::getSetting( 'runFromProtectedPagesOnly' ) === true && |
Check warning
Code scanning / Phpmd (reported by Codacy)
Static access leads to hard to test code Warning
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
@@ -62,7 +62,8 @@ | |||
$text = wfMessage( 'dpl_log_' . $errorMessageId, $args )->text(); | |||
} | |||
|
|||
$this->buffer[] = '<p>Extension:DynamicPageList3 (DPL3), version ' . Hooks::getVersion() . ': ' . $text . '</p>'; | |||
$this->buffer[] = '<p>Extension:DynamicPageList3 (DPL3), version ' . | |||
Hooks::getVersion() . ': ' . $text . '</p>'; |
Check warning
Code scanning / Phpmd (reported by Codacy)
Static access leads to hard to test code Warning
@@ -54,7 +54,10 @@ | |||
$updater = $page->newPageUpdater( User::newSystemUser( 'DynamicPageList3 extension' ) ); | |||
$content = $page->getContentHandler()->makeContent( '<noinclude>This page was automatically created. It serves as an anchor page for all \'\'\'[[Special:WhatLinksHere/Template:Extension_DPL|invocations]]\'\'\' of [https://www.mediawiki.org/wiki/Special:MyLanguage/Extension:DynamicPageList3 Extension:DynamicPageList3].</noinclude>', $title ); | |||
$updater->setContent( SlotRecord::MAIN, $content ); | |||
$comment = CommentStoreComment::newUnsavedComment( 'Autogenerated DynamicPageList3\'s necessary template for content inclusion.' ); | |||
|
|||
$comment = CommentStoreComment::newUnsavedComment( |
Check warning
Code scanning / Phpmd (reported by Codacy)
Static access leads to hard to test code Warning
$updater->setContent( SlotRecord::MAIN, $content ); | ||
$comment = CommentStoreComment::newUnsavedComment( 'Autogenerated DynamicPageList3\'s necessary template for content inclusion.' ); | ||
$updater = $page->newPageUpdater( | ||
User::newSystemUser( 'DynamicPageList3 extension' ) |
Check warning
Code scanning / Phpmd (reported by Codacy)
Static access leads to hard to test code Warning
Check commit and GitHub actions for more details
$maxLength = -1, | ||
$page = '?page?', | ||
$link = 'default', | ||
$trim = false |
Check warning
Code scanning / Phpmd (reported by Codacy)
You can fix this problem by extracting the logic in the boolean flag into its own class or method Warning
$parser->addTrackingCategory( 'dplchapter-parserfunc-tracking-category' ); | ||
$output = LST::extractHeadingFromText( $parser, $page, '?title?', $text, $heading, '', $sectionHeading, true, $maxLength, $link, $trim ); | ||
$output = LST::extractHeadingFromText( |
Check warning
Code scanning / Phpmd (reported by Codacy)
Static access leads to hard to test code Warning
$output = LST::extractHeadingFromText( $parser, $page, '?title?', $text, $heading, '', $sectionHeading, true, $maxLength, $link, $trim ); | ||
$output = LST::extractHeadingFromText( | ||
$parser, $page, '?title?', $text, $heading, '', | ||
$sectionHeading, true, $maxLength, $link, $trim |
Check warning
Code scanning / Phpmd (reported by Codacy)
Detects when a variable is used that has not been defined before Warning
$output = LST::extractHeadingFromText( $parser, $page, '?title?', $text, $heading, '', $sectionHeading, true, $maxLength, $link, $trim ); | ||
$output = LST::extractHeadingFromText( | ||
$parser, $page, '?title?', $text, $heading, '', | ||
$sectionHeading, true, $maxLength, $link, $trim |
Check notice
Code scanning / Phpmd (reported by Codacy)
Prohibit the definition or assignment of unused local variables Note
@@ -416,7 +436,14 @@ | |||
* @param string $matrix | |||
* @return string | |||
*/ | |||
public static function dplMatrixParserFunction( &$parser, $name = '', $yes = '', $no = '', $flip = '', $matrix = '' ) { | |||
public static function dplMatrixParserFunction( |
Check notice
Code scanning / Phpmd (reported by Codacy)
This pattern reports methods with high cyclomatic complexity Note
@@ -416,7 +436,14 @@ | |||
* @param string $matrix | |||
* @return string | |||
*/ | |||
public static function dplMatrixParserFunction( &$parser, $name = '', $yes = '', $no = '', $flip = '', $matrix = '' ) { | |||
public static function dplMatrixParserFunction( |
Check notice
Code scanning / Phpmd (reported by Codacy)
This pattern reports methods with a large number of possible paths Note
@@ -416,7 +436,14 @@ | |||
* @param string $matrix | |||
* @return string | |||
*/ | |||
public static function dplMatrixParserFunction( &$parser, $name = '', $yes = '', $no = '', $flip = '', $matrix = '' ) { | |||
public static function dplMatrixParserFunction( |
Check notice
Code scanning / Phpmd (reported by Codacy)
This pattern reports excessively long methods. Note
&$parser, | ||
$name = '', | ||
$yes = '', | ||
$no = '', |
Check warning
Code scanning / Phpmd (reported by Codacy)
Detects when a field, local, or parameter has a very short name. Warning
@@ -673,7 +705,10 @@ | |||
$parameter = trim( $parameter ); | |||
$namespaceId = $contLang->getNsIndex( $parameter ); | |||
|
|||
if ( $namespaceId === false || ( is_array( Config::getSetting( 'allowedNamespaces' ) ) && !in_array( $parameter, Config::getSetting( 'allowedNamespaces' ) ) ) ) { | |||
if ( $namespaceId === false || ( | |||
is_array( Config::getSetting( 'allowedNamespaces' ) ) && |
Check warning
Code scanning / Phpmd (reported by Codacy)
Static access leads to hard to test code Warning
if ( $namespaceId === false || ( is_array( Config::getSetting( 'allowedNamespaces' ) ) && !in_array( $parameter, Config::getSetting( 'allowedNamespaces' ) ) ) ) { | ||
if ( $namespaceId === false || ( | ||
is_array( Config::getSetting( 'allowedNamespaces' ) ) && | ||
!in_array( $parameter, Config::getSetting( 'allowedNamespaces' ) ) |
Check warning
Code scanning / Phpmd (reported by Codacy)
Static access leads to hard to test code Warning
@@ -559,14 +602,26 @@ | |||
* @param bool $optional | |||
* @return string | |||
*/ | |||
private static function updateTemplateCall( &$matchCount, $text, $template, $call, $parameter, $value, $afterParm, $optional ) { | |||
private static function updateTemplateCall( |
Check notice
Code scanning / Phpmd (reported by Codacy)
This pattern reports methods with a large number of possible paths Note
@@ -559,14 +602,26 @@ | |||
* @param bool $optional | |||
* @return string | |||
*/ | |||
private static function updateTemplateCall( &$matchCount, $text, $template, $call, $parameter, $value, $afterParm, $optional ) { | |||
private static function updateTemplateCall( |
Check notice
Code scanning / Phpmd (reported by Codacy)
This pattern reports methods with high cyclomatic complexity Note
@@ -559,14 +602,26 @@ | |||
* @param bool $optional | |||
* @return string | |||
*/ | |||
private static function updateTemplateCall( &$matchCount, $text, $template, $call, $parameter, $value, $afterParm, $optional ) { | |||
private static function updateTemplateCall( |
Check notice
Code scanning / Phpmd (reported by Codacy)
This pattern reports excessively long methods. Note
$parser, | ||
$text, | ||
$part1, | ||
$skiphead = 0, |
Check notice
Code scanning / Phpmd (reported by Codacy)
Prohibit the definition of unused parameters on methods or constructors Note
$text, | ||
$part1, | ||
$skiphead = 0, | ||
$recursionCheck = true, |
Check warning
Code scanning / Phpmd (reported by Codacy)
You can fix this problem by extracting the logic in the boolean flag into its own class or method Warning
$recursionCheck = true, | ||
$maxLength = -1, | ||
$link = '', | ||
$trim = false, |
Check warning
Code scanning / Phpmd (reported by Codacy)
You can fix this problem by extracting the logic in the boolean flag into its own class or method Warning
$parser, | ||
$page = '', | ||
$sec = '', | ||
$to = '', |
Check warning
Code scanning / Phpmd (reported by Codacy)
Detects when a field, local, or parameter has a very short name. Warning
$page = '', | ||
$sec = '', | ||
$to = '', | ||
$recursionCheck = true, |
Check warning
Code scanning / Phpmd (reported by Codacy)
You can fix this problem by extracting the logic in the boolean flag into its own class or method Warning
$title, | ||
$text, | ||
$sec, | ||
$to, |
Check warning
Code scanning / Phpmd (reported by Codacy)
Detects when a field, local, or parameter has a very short name. Warning
@@ -628,7 +699,19 @@ | |||
* @param string $catlist | |||
* @return array | |||
*/ | |||
public static function includeTemplate( $parser, Lister $lister, $dplNr, $article, $template1, $template2, $defaultTemplate, $mustMatch, $mustNotMatch, $matchParsed, $catlist ) { | |||
public static function includeTemplate( |
Check notice
Code scanning / Phpmd (reported by Codacy)
This pattern reports methods with high cyclomatic complexity Note
@@ -628,7 +699,19 @@ | |||
* @param string $catlist | |||
* @return array | |||
*/ | |||
public static function includeTemplate( $parser, Lister $lister, $dplNr, $article, $template1, $template2, $defaultTemplate, $mustMatch, $mustNotMatch, $matchParsed, $catlist ) { | |||
public static function includeTemplate( |
Check notice
Code scanning / Phpmd (reported by Codacy)
This pattern reports methods with a high number of parameters. Note
@@ -628,7 +699,19 @@ | |||
* @param string $catlist | |||
* @return array | |||
*/ | |||
public static function includeTemplate( $parser, Lister $lister, $dplNr, $article, $template1, $template2, $defaultTemplate, $mustMatch, $mustNotMatch, $matchParsed, $catlist ) { | |||
public static function includeTemplate( |
Check notice
Code scanning / Phpmd (reported by Codacy)
This pattern reports methods with a large number of possible paths Note
@@ -628,7 +699,19 @@ | |||
* @param string $catlist | |||
* @return array | |||
*/ | |||
public static function includeTemplate( $parser, Lister $lister, $dplNr, $article, $template1, $template2, $defaultTemplate, $mustMatch, $mustNotMatch, $matchParsed, $catlist ) { | |||
public static function includeTemplate( |
Check notice
Code scanning / Phpmd (reported by Codacy)
This pattern reports excessively long methods. Note
$secPiece[$s] = implode( isset( $this->multiSectionSeparators[$s] ) ? $this->replaceTagCount( $this->multiSectionSeparators[$s], $filteredCount ) : '', $secPieces ); | ||
|
||
if ( $this->getDominantSectionCount() >= 0 && $s == $this->getDominantSectionCount() && count( $secPieces ) > 1 ) { | ||
$secPieces = LST::includeSection( |
Check warning
Code scanning / Phpmd (reported by Codacy)
Static access leads to hard to test code Warning
$secPieces = LST::includeHeading( $this->parser, $article->mTitle->getPrefixedText(), substr( $sSecLabel, 1 ), '', $sectionHeading, false, $maxLength, $cutLink ?? 'default', $this->getTrimIncluded(), $skipPattern ?? [] ); | ||
// Uses LST::includeHeading() from LabeledSectionTransclusion extension to | ||
// include headings from the page | ||
$secPieces = LST::includeHeading( |
Check warning
Code scanning / Phpmd (reported by Codacy)
Static access leads to hard to test code Warning
$secPiece[$s] = implode( isset( $this->multiSectionSeparators[$s] ) ? $this->replaceTagCount( $this->multiSectionSeparators[$s], $filteredCount ) : '', $secPieces ); | ||
|
||
if ( $this->getDominantSectionCount() >= 0 && $s == $this->getDominantSectionCount() && count( $secPieces ) > 1 ) { | ||
$secPieces = LST::includeTemplate( |
Check warning
Code scanning / Phpmd (reported by Codacy)
Static access leads to hard to test code Warning
Check commit and GitHub actions for more details
@@ -194,7 +207,14 @@ | |||
} | |||
|
|||
$calcRows = false; | |||
if ( !Config::getSetting( 'allowUnlimitedResults' ) && $this->parameters->getParameter( 'goal' ) != 'categories' && strpos( $this->parameters->getParameter( 'resultsheader' ) . $this->parameters->getParameter( 'noresultsheader' ) . $this->parameters->getParameter( 'resultsfooter' ), '%TOTALPAGES%' ) !== false ) { | |||
if ( | |||
!Config::getSetting( 'allowUnlimitedResults' ) && |
Check warning
Code scanning / Phpmd (reported by Codacy)
Static access leads to hard to test code Warning
@@ -687,108 +742,175 @@ | |||
} | |||
|
|||
// Too many categories. | |||
if ( $totalCategories > Config::getSetting( 'maxCategoryCount' ) && !Config::getSetting( 'allowUnlimitedCategories' ) ) { | |||
if ( | |||
$totalCategories > Config::getSetting( 'maxCategoryCount' ) && |
Check warning
Code scanning / Phpmd (reported by Codacy)
Static access leads to hard to test code Warning
if ( $totalCategories > Config::getSetting( 'maxCategoryCount' ) && !Config::getSetting( 'allowUnlimitedCategories' ) ) { | ||
if ( | ||
$totalCategories > Config::getSetting( 'maxCategoryCount' ) && | ||
!Config::getSetting( 'allowUnlimitedCategories' ) |
Check warning
Code scanning / Phpmd (reported by Codacy)
Static access leads to hard to test code Warning
@@ -2058,15 +2095,18 @@ | |||
foreach ( $titles as $title ) { | |||
if ( $this->parameters->getParameter( 'openreferences' ) ) { | |||
if ( $this->parameters->getParameter( 'ignorecase' ) ) { | |||
$_or = "LOWER(CAST(lt_title AS char)) {$comparisonType}" . strtolower( $this->dbr->addQuotes( $title ) ); | |||
$_or = "LOWER(CAST(lt_title AS char)) {$comparisonType}" . |
Check notice
Code scanning / Phpmd (reported by Codacy)
Requires all variable names to use the CamelCase style Note
@@ -2090,15 +2130,18 @@ | |||
foreach ( $titles as $title ) { | |||
if ( $this->parameters->getParameter( 'openreferences' ) ) { | |||
if ( $this->parameters->getParameter( 'ignorecase' ) ) { | |||
$_or = "LOWER(CAST(lt_title AS char)) {$comparisonType}" . strtolower( $this->dbr->addQuotes( $title ) ); | |||
$_or = "LOWER(CAST(lt_title AS char)) {$comparisonType}" . |
Check notice
Code scanning / Phpmd (reported by Codacy)
Requires all variable names to use the CamelCase style Note
@@ -357,7 +362,9 @@ | |||
$this->sqlQuery = $query; | |||
} | |||
} catch ( Exception $e ) { | |||
throw new LogicException( __METHOD__ . ': ' . wfMessage( 'dpl_query_error', Hooks::getVersion(), $this->dbr->lastError() )->text() ); | |||
throw new LogicException( __METHOD__ . ': ' . wfMessage( | |||
'dpl_query_error', Hooks::getVersion(), $this->dbr->lastError() |
Check warning
Code scanning / Phpmd (reported by Codacy)
Static access leads to hard to test code Warning
No description provided.