wikimedia/mediawiki-core

View on GitHub
includes/parser/Parsoid/Config/SiteConfig.php

Summary

Maintainability
F
3 days
Test Coverage

File SiteConfig.php has 514 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Copyright (C) 2011-2022 Wikimedia Foundation and others.
 *
 * This program is free software; you can redistribute it and/or modify
Severity: Major
Found in includes/parser/Parsoid/Config/SiteConfig.php - About 1 day to fix

    SiteConfig has 56 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class SiteConfig extends ISiteConfig {
    
        /**
         * Regular expression fragment for matching wikitext comments.
         * Meant for inclusion in other regular expressions.
    Severity: Major
    Found in includes/parser/Parsoid/Config/SiteConfig.php - About 1 day to fix

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

          public function interwikiMap(): array {
              // Unfortunate that this mostly duplicates \ApiQuerySiteinfo::appendInterwikiMap()
              if ( $this->interwikiMap !== null ) {
                  return $this->interwikiMap;
              }
      Severity: Minor
      Found in includes/parser/Parsoid/Config/SiteConfig.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 __construct has 18 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              ServiceOptions $config,
              array $parsoidSettings,
              ObjectFactory $objectFactory,
              Language $contentLanguage,
              StatsdDataFactoryInterface $stats,
      Severity: Major
      Found in includes/parser/Parsoid/Config/SiteConfig.php - About 2 hrs to fix

        Method interwikiMap has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function interwikiMap(): array {
                // Unfortunate that this mostly duplicates \ApiQuerySiteinfo::appendInterwikiMap()
                if ( $this->interwikiMap !== null ) {
                    return $this->interwikiMap;
                }
        Severity: Minor
        Found in includes/parser/Parsoid/Config/SiteConfig.php - About 1 hr to fix

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

              public function variants(): array {
                  // Deprecated for all external callers; to make private and remove this warning.
                  if ( wfGetCaller() !== __CLASS__ . '->variantsFor' ) {
                      wfDeprecated( __METHOD__, '1.43' );
                  }
          Severity: Minor
          Found in includes/parser/Parsoid/Config/SiteConfig.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 __construct has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function __construct(
                  ServiceOptions $config,
                  array $parsoidSettings,
                  ObjectFactory $objectFactory,
                  Language $contentLanguage,
          Severity: Minor
          Found in includes/parser/Parsoid/Config/SiteConfig.php - About 1 hr to fix

            Method variants has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function variants(): array {
                    // Deprecated for all external callers; to make private and remove this warning.
                    if ( wfGetCaller() !== __CLASS__ . '->variantsFor' ) {
                        wfDeprecated( __METHOD__, '1.43' );
                    }
            Severity: Minor
            Found in includes/parser/Parsoid/Config/SiteConfig.php - About 1 hr to fix

              There are no issues that match your filters.

              Category
              Status