spotweb/spotweb

View on GitHub
lib/SpotInstall.php

Summary

Maintainability
F
3 days
Test Coverage

Function askNntpSettings has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

    public static function askNntpSettings()
    {
        global $settings;

        // Loading the file directly seems to sometimes result in a weird error. GH issue #1861
Severity: Minor
Found in lib/SpotInstall.php - About 6 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

File SpotInstall.php has 410 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Created by PhpStorm.
 * User: root
Severity: Minor
Found in lib/SpotInstall.php - About 5 hrs to fix

    Method askNntpSettings has 93 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function askNntpSettings()
        {
            global $settings;
    
            // Loading the file directly seems to sometimes result in a weird error. GH issue #1861
    Severity: Major
    Found in lib/SpotInstall.php - About 3 hrs to fix

      Method createSystem has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function createSystem()
          {
              try {
                  /**
                   * The settings system is used to create a lot of output,
      Severity: Major
      Found in lib/SpotInstall.php - About 2 hrs to fix

        Method askDbSettings has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function askDbSettings()
            {
                global $settings;
        
                if (!isset($settings['mydb'])) {
        Severity: Major
        Found in lib/SpotInstall.php - About 2 hrs to fix

          Method askSpotwebSettings has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function askSpotwebSettings()
              {
                  global $settings;
          
                  if (!isset($settings['myadminuser'])) {
          Severity: Major
          Found in lib/SpotInstall.php - About 2 hrs to fix

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

                public static function createDbSettingsFile($engine)
                {
                    $dbSettings = $_SESSION['spotsettings']['db'];
                    switch ($_SESSION['spotsettings']['db']['engine']) {
                        case 'pdo_pgsql':
            Severity: Minor
            Found in lib/SpotInstall.php - About 2 hrs to fix

              Function askDbSettings has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function askDbSettings()
                  {
                      global $settings;
              
                      if (!isset($settings['mydb'])) {
              Severity: Minor
              Found in lib/SpotInstall.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 askSpotwebSettings has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function askSpotwebSettings()
                  {
                      global $settings;
              
                      if (!isset($settings['myadminuser'])) {
              Severity: Minor
              Found in lib/SpotInstall.php - About 55 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 showResult has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function showResult($b, $isRequired, $okMsg = '', $nokMsg = '')
                  {
                      global $_testInstall_Ok;
              
                      if ($b) {
              Severity: Minor
              Found in lib/SpotInstall.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

              Method ownWarning has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public static function ownWarning($number, $message, $file, $line, array $context = [])
              Severity: Minor
              Found in lib/SpotInstall.php - About 35 mins to fix

                There are no issues that match your filters.

                Category
                Status