wikimedia/mediawiki-core

View on GitHub
includes/api/ApiQueryAllLinks.php

Summary

Maintainability
D
3 days
Test Coverage

Function run has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
Open

    private function run( $resultPageSet = null ) {
        $db = $this->getDB();
        $params = $this->extractRequestParams();

        $pfx = $this->tablePrefix;
Severity: Minor
Found in includes/api/ApiQueryAllLinks.php - About 1 day to fix

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 run has 166 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function run( $resultPageSet = null ) {
        $db = $this->getDB();
        $params = $this->extractRequestParams();

        $pfx = $this->tablePrefix;
Severity: Major
Found in includes/api/ApiQueryAllLinks.php - About 6 hrs to fix

    File ApiQueryAllLinks.php has 312 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * Copyright © 2006 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
     *
     * This program is free software; you can redistribute it and/or modify
    Severity: Minor
    Found in includes/api/ApiQueryAllLinks.php - About 3 hrs to fix

      Method __construct has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function __construct(
              ApiQuery $query,
              $moduleName,
              NamespaceInfo $namespaceInfo,
              GenderCache $genderCache,
      Severity: Minor
      Found in includes/api/ApiQueryAllLinks.php - About 1 hr to fix

        Method getAllowedParams has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getAllowedParams() {
                $allowedParams = [
                    'continue' => [
                        ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
                    ],
        Severity: Minor
        Found in includes/api/ApiQueryAllLinks.php - About 1 hr to fix

          Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  ApiQuery $query,
                  $moduleName,
                  NamespaceInfo $namespaceInfo,
                  GenderCache $genderCache,
                  LinksMigration $linksMigration
          Severity: Minor
          Found in includes/api/ApiQueryAllLinks.php - About 35 mins to fix

            There are no issues that match your filters.

            Category
            Status