wikimedia/mediawiki-core

View on GitHub
includes/changetags/ChangeTagsStore.php

Summary

Maintainability
F
4 days
Test Coverage

File ChangeTagsStore.php has 588 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: Major
Found in includes/changetags/ChangeTagsStore.php - About 1 day to fix

    Method updateTags has 144 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function updateTags( $tagsToAdd, $tagsToRemove, &$rc_id = null,
            &$rev_id = null, &$log_id = null, $params = null, RecentChange $rc = null,
            UserIdentity $user = null
        ) {
            $tagsToAdd = array_filter(
    Severity: Major
    Found in includes/changetags/ChangeTagsStore.php - About 5 hrs to fix

      Function modifyDisplayQueryBuilder has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

          public function modifyDisplayQueryBuilder(
              SelectQueryBuilder $queryBuilder,
              $table,
              $filter_tag = '',
              bool $exclude = false
      Severity: Minor
      Found in includes/changetags/ChangeTagsStore.php - About 3 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

      Function modifyDisplayQuery has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

          public function modifyDisplayQuery( &$tables, &$fields, &$conds,
              &$join_conds, &$options, $filter_tag = '', bool $exclude = false
          ) {
              $useTagFilter = $this->options->get( MainConfigNames::UseTagFilter );
      
      
      Severity: Minor
      Found in includes/changetags/ChangeTagsStore.php - About 3 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

      Function updateTags has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          public function updateTags( $tagsToAdd, $tagsToRemove, &$rc_id = null,
              &$rev_id = null, &$log_id = null, $params = null, RecentChange $rc = null,
              UserIdentity $user = null
          ) {
              $tagsToAdd = array_filter(
      Severity: Minor
      Found in includes/changetags/ChangeTagsStore.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 modifyDisplayQuery has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function modifyDisplayQuery( &$tables, &$fields, &$conds,
              &$join_conds, &$options, $filter_tag = '', bool $exclude = false
          ) {
              $useTagFilter = $this->options->get( MainConfigNames::UseTagFilter );
      
      
      Severity: Major
      Found in includes/changetags/ChangeTagsStore.php - About 2 hrs to fix

        Method modifyDisplayQueryBuilder has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function modifyDisplayQueryBuilder(
                SelectQueryBuilder $queryBuilder,
                $table,
                $filter_tag = '',
                bool $exclude = false
        Severity: Major
        Found in includes/changetags/ChangeTagsStore.php - About 2 hrs to fix

          Method updateTags has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function updateTags( $tagsToAdd, $tagsToRemove, &$rc_id = null,
                  &$rev_id = null, &$log_id = null, $params = null, RecentChange $rc = null,
                  UserIdentity $user = null
          Severity: Major
          Found in includes/changetags/ChangeTagsStore.php - About 1 hr to fix

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

                    IConnectionProvider $dbProvider,
                    NameTableStore $changeTagDefStore,
                    WANObjectCache $wanCache,
                    HookContainer $hookContainer,
                    LoggerInterface $logger,
            Severity: Major
            Found in includes/changetags/ChangeTagsStore.php - About 50 mins to fix

              Method modifyDisplayQuery has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public function modifyDisplayQuery( &$tables, &$fields, &$conds,
                      &$join_conds, &$options, $filter_tag = '', bool $exclude = false
              Severity: Major
              Found in includes/changetags/ChangeTagsStore.php - About 50 mins to fix

                Method logTagManagementAction has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public function logTagManagementAction( string $action, string $tag, string $reason,
                        UserIdentity $user, $tagCount = null, array $logEntryTags = []
                Severity: Minor
                Found in includes/changetags/ChangeTagsStore.php - About 45 mins to fix

                  Method addTags has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public function addTags( $tags, $rc_id = null, $rev_id = null,
                          $log_id = null, $params = null, RecentChange $rc = null
                  Severity: Minor
                  Found in includes/changetags/ChangeTagsStore.php - About 45 mins to fix

                    There are no issues that match your filters.

                    Category
                    Status