wikimedia/mediawiki-core

View on GitHub
includes/api/ApiParamInfo.php

Summary

Maintainability
F
4 days
Test Coverage

Function execute has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        // Get parameters
        $params = $this->extractRequestParams();

        $this->helpFormat = $params['helpformat'];
Severity: Minor
Found in includes/api/ApiParamInfo.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

Function getModuleInfo has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
Open

    private function getModuleInfo( $module ) {
        $ret = [];
        $path = $module->getModulePath();
        $paramValidator = $module->getMain()->getParamValidator();

Severity: Minor
Found in includes/api/ApiParamInfo.php - About 7 hrs 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 getModuleInfo has 131 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function getModuleInfo( $module ) {
        $ret = [];
        $path = $module->getModulePath();
        $paramValidator = $module->getMain()->getParamValidator();

Severity: Major
Found in includes/api/ApiParamInfo.php - About 5 hrs to fix

    File ApiParamInfo.php has 363 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * Copyright © 2008 Roan Kattouw <roan.kattouw@gmail.com>
     *
     * This program is free software; you can redistribute it and/or modify
    Severity: Minor
    Found in includes/api/ApiParamInfo.php - About 4 hrs to fix

      Method execute has 104 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function execute() {
              // Get parameters
              $params = $this->extractRequestParams();
      
              $this->helpFormat = $params['helpformat'];
      Severity: Major
      Found in includes/api/ApiParamInfo.php - About 4 hrs to fix

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

            protected function formatHelpMessages( array &$res, $key, array $msgs, $joinLists = false ) {
                switch ( $this->helpFormat ) {
                    case 'none':
                        break;
        
        
        Severity: Minor
        Found in includes/api/ApiParamInfo.php - About 1 hr to fix

          Function formatHelpMessages has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function formatHelpMessages( array &$res, $key, array $msgs, $joinLists = false ) {
                  switch ( $this->helpFormat ) {
                      case 'none':
                          break;
          
          
          Severity: Minor
          Found in includes/api/ApiParamInfo.php - About 1 hr 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 getAllowedParams has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getAllowedParams() {
                  // back compat
                  $querymodules = $this->getMain()->getModuleManager()
                      ->getModule( 'query' )->getModuleManager()->getNames();
                  sort( $querymodules );
          Severity: Minor
          Found in includes/api/ApiParamInfo.php - About 1 hr to fix

            Function listAllSubmodules has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                private function listAllSubmodules( ApiBase $module, $recursive ) {
                    $paths = [];
                    $manager = $module->getModuleManager();
                    if ( $manager ) {
                        $names = $manager->getNames();
            Severity: Minor
            Found in includes/api/ApiParamInfo.php - About 35 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