wikimedia/mediawiki-core

View on GitHub
includes/skins/components/SkinComponentFooter.php

Summary

Maintainability
C
1 day
Test Coverage

Function getFooterIconsData has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getFooterIconsData( Config $config ) {
        $footericons = [];
        foreach (
            $config->get( MainConfigNames::FooterIcons ) as $footerIconsKey => &$footerIconsBlock
        ) {
Severity: Minor
Found in includes/skins/components/SkinComponentFooter.php - About 4 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 getFooterIcons has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    private function getFooterIcons(): array {
        $dataIcons = [];
        $skinContext = $this->skinContext;
        // If footer icons are enabled append to the end of the rows
        $footerIcons = $skinContext->getFooterIcons();
Severity: Minor
Found in includes/skins/components/SkinComponentFooter.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 getFooterIcons has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function getFooterIcons(): array {
        $dataIcons = [];
        $skinContext = $this->skinContext;
        // If footer icons are enabled append to the end of the rows
        $footerIcons = $skinContext->getFooterIcons();
Severity: Minor
Found in includes/skins/components/SkinComponentFooter.php - About 1 hr to fix

    Method makeFooterIconHTML has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function makeFooterIconHTML( Config $config, $icon, string $withImage = 'withImage' ): string {
            if ( is_string( $icon ) ) {
                $html = $icon;
            } else { // Assuming array
                $url = $icon['url'] ?? null;
    Severity: Minor
    Found in includes/skins/components/SkinComponentFooter.php - About 1 hr to fix

      Method getFooterInfoData has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function getFooterInfoData(): array {
              $action = null;
              $skinContext = $this->skinContext;
              $out = $skinContext->getOutput();
              $ctx = $skinContext->getContextSource();
      Severity: Minor
      Found in includes/skins/components/SkinComponentFooter.php - About 1 hr to fix

        Function makeFooterIconHTML has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function makeFooterIconHTML( Config $config, $icon, string $withImage = 'withImage' ): string {
                if ( is_string( $icon ) ) {
                    $html = $icon;
                } else { // Assuming array
                    $url = $icon['url'] ?? null;
        Severity: Minor
        Found in includes/skins/components/SkinComponentFooter.php - About 45 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 getSiteFooterLinks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            private function getSiteFooterLinks(): array {
                $siteLinksData = [];
                $siteLinks = [
                    'privacy' => [ 'privacy', 'privacypage' ],
                    'about' => [ 'aboutsite', 'aboutpage' ],
        Severity: Minor
        Found in includes/skins/components/SkinComponentFooter.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