Function getFileInfo
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
public function getFileInfo( IPageConfig $pageConfig, array $files ): array {
$page = Title::newFromLinkTarget( $pageConfig->getLinkTarget() );
$keys = [];
foreach ( $files as $f ) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
File DataAccess.php
has 309 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Copyright (C) 2011-2022 Wikimedia Foundation and others.
*
* This program is free software; you can redistribute it and/or modify
Method getFileInfo
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getFileInfo( IPageConfig $pageConfig, array $files ): array {
$page = Title::newFromLinkTarget( $pageConfig->getLinkTarget() );
$keys = [];
foreach ( $files as $f ) {
Method getPageInfo
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getPageInfo( $pageConfigOrTitle, array $titles ): array {
if ( $pageConfigOrTitle instanceof IPageConfig ) {
$context_title = Title::newFromLinkTarget(
$pageConfigOrTitle->getLinkTarget()
);
Function getPageInfo
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function getPageInfo( $pageConfigOrTitle, array $titles ): array {
if ( $pageConfigOrTitle instanceof IPageConfig ) {
$context_title = Title::newFromLinkTarget(
$pageConfigOrTitle->getLinkTarget()
);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method __construct
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
ServiceOptions $config,
RepoGroup $repoGroup,
BadFileLookup $badFileLookup,
HookContainer $hookContainer,
ContentTransformer $contentTransformer,
Function makeTransformOptions
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function makeTransformOptions( IPageConfig $pageConfig, $file, array $hp ): array {
// Validate the input parameters like Parser::makeImage()
$handler = $file->getHandler();
if ( !$handler ) {
return []; // will get iconThumb()
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"