wikimedia/mediawiki-core

View on GitHub
includes/api/ApiQueryBacklinksprop.php

Summary

Maintainability
F
3 days
Test Coverage

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

    private function run( ApiPageSet $resultPageSet = null ) {
        $settings = self::$settings[$this->getModuleName()];

        $db = $this->getDB();
        $params = $this->extractRequestParams();
Severity: Minor
Found in includes/api/ApiQueryBacklinksprop.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 190 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function run( ApiPageSet $resultPageSet = null ) {
        $settings = self::$settings[$this->getModuleName()];

        $db = $this->getDB();
        $params = $this->extractRequestParams();
Severity: Major
Found in includes/api/ApiQueryBacklinksprop.php - About 7 hrs to fix

    File ApiQueryBacklinksprop.php has 345 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * API module to handle links table back-queries
     *
     * Copyright © 2014 Wikimedia Foundation and contributors
    Severity: Minor
    Found in includes/api/ApiQueryBacklinksprop.php - About 4 hrs to fix

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

          public function getAllowedParams() {
              $settings = self::$settings[$this->getModuleName()];
      
              $ret = [
                  'prop' => [
      Severity: Major
      Found in includes/api/ApiQueryBacklinksprop.php - About 2 hrs to fix

        Function getAllowedParams has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getAllowedParams() {
                $settings = self::$settings[$this->getModuleName()];
        
                $ret = [
                    'prop' => [
        Severity: Minor
        Found in includes/api/ApiQueryBacklinksprop.php - About 45 mins 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

        There are no issues that match your filters.

        Category
        Status