wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Function appendUserGroups has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    protected function appendUserGroups( $property, $numberInGroup ) {
        $config = $this->getConfig();

        $data = [];
        $result = $this->getResult();
Severity: Minor
Found in includes/api/ApiQuerySiteinfo.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 showRevision has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    private function showRevision( $timestamp ) {
        if ( !preg_match( '/[0-9]{14}/', $timestamp ) ) {
            return;
        }
        $out = $this->getOutput();
Severity: Minor
Found in includes/specials/SpecialUndelete.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 getHeadLinksArray has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    public function getHeadLinksArray() {
        $tags = [];
        $config = $this->getConfig();

        if ( $this->cspOutputMode === self::CSP_META ) {
Severity: Minor
Found in includes/Output/OutputPage.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 pop has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    public function pop( $qtype = self::TYPE_DEFAULT, $flags = 0, array $ignored = [] ) {
        $job = false;

        if ( !$this->localJobClasses ) {
            throw new JobQueueError(
Severity: Minor
Found in includes/jobqueue/JobQueueGroup.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 processSetting has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    private function processSetting( $thisSetting, $wiki, $tags ) {
        // Optimization: Avoid native type hint on private method called by hot getAll()
        // <https://gerrit.wikimedia.org/r/c/mediawiki/core/+/820244>

        $retval = null;
Severity: Minor
Found in includes/config/SiteConfiguration.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 moveIllegalPage has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    protected function moveIllegalPage( $row ) {
        $legalChars = Title::legalChars();
        $legalizedUnprefixed = preg_replace_callback( "/([^$legalChars])/",
            [ $this, 'hexChar' ],
            $row->page_title );
Severity: Minor
Found in maintenance/cleanupTitles.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 execute has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        $dbr = $this->getReplicaDB();
        $dbw = $this->getPrimaryDB();

        $dryRun = true;
Severity: Minor
Found in maintenance/fixMergeHistoryCorruption.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 execute has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        # Options processing
        $username = $this->getOption( 'u', false );
        $reason = $this->getOption( 'r', '' );
        $interval = $this->getOption( 'i', 0 );
Severity: Minor
Found in maintenance/moveBatch.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 execute has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        $force = $this->getOption( 'force' );
        $startFrom = $this->getOption( 'start-from' );

        // We need the namespace index instead of the name to perform the query
Severity: Minor
Found in maintenance/prewarmParsoidParserCache.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 removeRules has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

def removeRules(path, table):
    fp = open(path, 'r', encoding='U8')
    texc = list()
    for line in fp:
        elems = line.split('=>')
Severity: Minor
Found in maintenance/language/zhtable/Makefile.py - 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 useButtonGroupKeyboardNav has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function useButtonGroupKeyboardNav(buttonsProp) {
  const rootElement = ref();
  const focusedButtonIndex = ref();
  const buttonRefs = ref(/* @__PURE__ */ new Map());
  const currentDirection = useComputedDirection(rootElement);
Severity: Major
Found in resources/lib/codex/codex.js - About 3 hrs to fix

    Function setup has 77 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      setup(props, { emit, attrs }) {
        const idAttribute = attrs.id;
        const {
          computedDisabled,
          computedStatus,
    Severity: Major
    Found in resources/lib/codex/codex.js - About 3 hrs to fix

      Function computePosition$1 has 77 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const computePosition$1 = (reference, floating, config) => __async(void 0, null, function* () {
        const {
          placement = "bottom",
          strategy = "absolute",
          middleware = [],
      Severity: Major
      Found in resources/lib/codex/codex.js - About 3 hrs to fix

        Function useFloatingMenu has 77 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function useFloatingMenu(referenceElement, menu, opt) {
          var _a;
          const menuIsExpanded = () => {
            var _a2;
            return (_a2 = menu.value) == null ? void 0 : _a2.isExpanded();
        Severity: Major
        Found in resources/lib/codex/codex.js - About 3 hrs to fix

          Function deepEqual has 77 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  return (function deepEqual(obj1, obj2, path1, path2) {
                      var type1 = typeof obj1;
                      var type2 = typeof obj2;
          
                      // == null also matches undefined
          Severity: Major
          Found in resources/lib/sinonjs/sinon.js - About 3 hrs to fix

            Function send has 77 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                        send: function( headers, complete ) {
                            var i,
                                xhr = options.xhr();
            
                            xhr.open(
            Severity: Major
            Found in resources/lib/jquery/jquery.js - About 3 hrs to fix

              Function deflate_slow has 77 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                const deflate_slow = (s, flush) => {
              
                  let hash_head;          /* head of hash chain */
                  let bflush;              /* set if current block must be flushed */
              
              
              Severity: Major
              Found in resources/lib/pako/pako_deflate.js - About 3 hrs to fix

                Method updateSourcePage has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function updateSourcePage( $status, $performer, $reason ): void {
                        $deleteSource = false;
                        $legacySourceTitle = $this->titleFactory->newFromPageIdentity( $this->source );
                        $legacyDestTitle = $this->titleFactory->newFromPageIdentity( $this->dest );
                        $sourceModel = $legacySourceTitle->getContentModel();
                Severity: Major
                Found in includes/page/MergeHistory.php - About 3 hrs to fix

                  Method checkCache has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function checkCache( PageIdentity $page, Content $content, UserIdentity $user ) {
                          $legacyUser = $this->userFactory->newFromUserIdentity( $user );
                          if (
                              // The context is not an HTTP POST request
                              !$legacyUser->getRequest()->wasPosted() ||
                  Severity: Major
                  Found in includes/Storage/PageEditStash.php - About 3 hrs to fix

                    Method getSidebar has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function getSidebar( $options = [] ) {
                            // Force the rendering of the following portals
                            $sidebar = $this->data['sidebar'];
                            if ( !isset( $sidebar['SEARCH'] ) ) {
                                // @phan-suppress-next-line PhanTypeMismatchDimAssignment False positive
                    Severity: Major
                    Found in includes/skins/BaseTemplate.php - About 3 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language