wikimedia/mediawiki-core

View on GitHub
includes/specials/SpecialTags.php

Summary

Maintainability
D
2 days
Test Coverage

File SpecialTags.php has 361 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
Severity: Minor
Found in includes/specials/SpecialTags.php - About 4 hrs to fix

    Method doTagRow has 87 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function doTagRow(
            $tag, $hitcount, $showManageActions, $showDeleteActions, $showEditLinks
        ) {
            $newRow = '';
            $newRow .= Xml::tags( 'td', null, Xml::element( 'code', null, $tag ) );
    Severity: Major
    Found in includes/specials/SpecialTags.php - About 3 hrs to fix

      Method showTagList has 78 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function showTagList() {
              $out = $this->getOutput();
              $out->setPageTitleMsg( $this->msg( 'tags-title' ) );
              $out->wrapWikiMsg( "<div class='mw-tags-intro'>\n$1\n</div>", 'tags-intro' );
      
      
      Severity: Major
      Found in includes/specials/SpecialTags.php - About 3 hrs to fix

        Function doTagRow has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            private function doTagRow(
                $tag, $hitcount, $showManageActions, $showDeleteActions, $showEditLinks
            ) {
                $newRow = '';
                $newRow .= Xml::tags( 'td', null, Xml::element( 'code', null, $tag ) );
        Severity: Minor
        Found in includes/specials/SpecialTags.php - About 2 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 showDeleteTagForm has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function showDeleteTagForm( $tag ) {
                $authority = $this->getAuthority();
                if ( !$authority->isAllowed( 'deletechangetags' ) ) {
                    throw new PermissionsError( 'deletechangetags' );
                }
        Severity: Minor
        Found in includes/specials/SpecialTags.php - About 1 hr to fix

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

              protected function showActivateDeactivateForm( $tag, $activate ) {
                  $actionStr = $activate ? 'activate' : 'deactivate';
          
                  $authority = $this->getAuthority();
                  if ( !$authority->isAllowed( 'managechangetags' ) ) {
          Severity: Minor
          Found in includes/specials/SpecialTags.php - About 1 hr to fix

            Method processCreateTagForm has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function processCreateTagForm( array $data, HTMLForm $form ) {
                    $context = $form->getContext();
                    $out = $context->getOutput();
            
                    $tag = trim( strval( $data['Tag'] ) );
            Severity: Minor
            Found in includes/specials/SpecialTags.php - About 1 hr to fix

              Function showTagList has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function showTagList() {
                      $out = $this->getOutput();
                      $out->setPageTitleMsg( $this->msg( 'tags-title' ) );
                      $out->wrapWikiMsg( "<div class='mw-tags-intro'>\n$1\n</div>", 'tags-intro' );
              
              
              Severity: Minor
              Found in includes/specials/SpecialTags.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 doTagRow has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      $tag, $hitcount, $showManageActions, $showDeleteActions, $showEditLinks
              Severity: Minor
              Found in includes/specials/SpecialTags.php - About 35 mins to fix

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

                    protected function showDeleteTagForm( $tag ) {
                        $authority = $this->getAuthority();
                        if ( !$authority->isAllowed( 'deletechangetags' ) ) {
                            throw new PermissionsError( 'deletechangetags' );
                        }
                Severity: Minor
                Found in includes/specials/SpecialTags.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

                Function showActivateDeactivateForm has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function showActivateDeactivateForm( $tag, $activate ) {
                        $actionStr = $activate ? 'activate' : 'deactivate';
                
                        $authority = $this->getAuthority();
                        if ( !$authority->isAllowed( 'managechangetags' ) ) {
                Severity: Minor
                Found in includes/specials/SpecialTags.php - About 25 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