wikimedia/mediawiki-core

View on GitHub
includes/specials/SpecialEditTags.php

Summary

Maintainability
D
2 days
Test Coverage

File SpecialEditTags.php has 338 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/SpecialEditTags.php - About 4 hrs to fix

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

        public function execute( $par ) {
            $this->checkPermissions();
            $this->checkReadOnly();
    
            $output = $this->getOutput();
    Severity: Major
    Found in includes/specials/SpecialEditTags.php - About 2 hrs to fix

      Method showForm has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function showForm() {
              $out = $this->getOutput();
              // Messages: tags-edit-revision-selected, tags-edit-logentry-selected
              $out->wrapWikiMsg( "<strong>$1</strong>", [
                  "tags-edit-{$this->typeName}-selected",
      Severity: Major
      Found in includes/specials/SpecialEditTags.php - About 2 hrs to fix

        Method buildCheckBoxes has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function buildCheckBoxes() {
                // If there is just one item, provide the user with a multi-select field
                $list = $this->getList();
                $tags = [];
                if ( $list->length() == 1 ) {
        Severity: Minor
        Found in includes/specials/SpecialEditTags.php - About 2 hrs to fix

          Function buildCheckBoxes has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function buildCheckBoxes() {
                  // If there is just one item, provide the user with a multi-select field
                  $list = $this->getList();
                  $tags = [];
                  if ( $list->length() == 1 ) {
          Severity: Minor
          Found in includes/specials/SpecialEditTags.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

          Function submit has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function submit() {
                  // Check edit token on submission
                  $request = $this->getRequest();
                  $token = $request->getVal( 'wpEditToken' );
                  if ( $this->submitClicked && !$this->getUser()->matchEditToken( $token ) ) {
          Severity: Minor
          Found in includes/specials/SpecialEditTags.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 submit has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function submit() {
                  // Check edit token on submission
                  $request = $this->getRequest();
                  $token = $request->getVal( 'wpEditToken' );
                  if ( $this->submitClicked && !$this->getUser()->matchEditToken( $token ) ) {
          Severity: Minor
          Found in includes/specials/SpecialEditTags.php - About 1 hr to fix

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

                public function execute( $par ) {
                    $this->checkPermissions();
                    $this->checkReadOnly();
            
                    $output = $this->getOutput();
            Severity: Minor
            Found in includes/specials/SpecialEditTags.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 showConvenienceLinks has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function showConvenienceLinks() {
                    // Give a link to the logs/hist for this page
                    if ( $this->targetObj ) {
                        // Also set header tabs to be for the target.
                        $this->getSkin()->setRelevantTitle( $this->targetObj );
            Severity: Minor
            Found in includes/specials/SpecialEditTags.php - About 1 hr to fix

              There are no issues that match your filters.

              Category
              Status