TikiWiki/tiki-manager

View on GitHub

Showing 332 of 2,142 total issues

Avoid deeply nested control flow statements.
Open

                        switch ($field_type[$i]) {
                            case 'int':
                                $out = $row[$i];
                                break;
                            case 'string':
Severity: Major
Found in scripts/tiki/mysqldump.php - About 45 mins to fix

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

        public function setupDatabase(Database $database)
        {
            $tmp = tempnam($_ENV['TEMP_FOLDER'], 'dblocal');
            $dbFileContents = $this->generateDbFileContent($database);
            file_put_contents($tmp, $dbFileContents);
    Severity: Minor
    Found in src/Application/Tiki.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 debug has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    function debug($text, $prefix = null, $hr = '')
    {
        if (isset($_ENV['TRIM_DEBUG']) && $_ENV['TRIM_DEBUG'] === true) {
            $prefix = '[' . date('Y-m-d H:i:s') . '][debug]:' . ($prefix ? " {$prefix}" : '');
            $output = "\n";
    Severity: Minor
    Found in src/Libs/Helpers/functions.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 getCompatibleVersions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getCompatibleVersions(bool $withBlank = true)
        {
            $versions = $this->getVersions();
            $checkTikiVersionRequirement = $this->getTikiRequirementsHelper();
            $compatible = [];
    Severity: Minor
    Found in src/Application/Tiki.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 log has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function log($level, $message, array $context = [])
        {
            if (!isset($this->verbosityLevelMap[$level])) {
                throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level));
            }
    Severity: Minor
    Found in src/Logger/ConsoleLogger.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 checksumFolder has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function checksumFolder($folder, $callback = null)
        {
            $result = [];
    
            if (!is_callable($callback)) {
    Severity: Minor
    Found in src/Libs/Audit/Checksum.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 performActualUpdate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function performActualUpdate(Version $version, $options = [])
        {
            $access = $this->instance->getBestAccess('scripting');
            $vcsType = $this->vcs_instance->getIdentifier();
            $can_svn = $access->hasExecutable('svn') && $vcsType == 'SVN';
    Severity: Minor
    Found in src/Application/Tiki.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 formatHtml has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        private function formatHtml($matches)
        {
            $out = '<span style="';
            foreach (explode(';', $matches[1]) as $code) {
                if (isset(self::$availableForegroundColors[$code])) {
    Severity: Minor
    Found in src/Style/Formatter/HtmlOutputFormatter.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 detectDistro has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function detectDistro()
        {
            if (isset($this->config['distro'])) {
                return $this->config['distro'];
            }
    Severity: Minor
    Found in src/Application/Discovery.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 exec has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function exec($targetFolder, $toAppend)
        {
            static $tmpFolderChecked;
            if ((empty($tmpFolderChecked) || !in_array(
                $targetFolder,
    Severity: Minor
    Found in src/Libs/VersionControl/Svn.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 __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function __construct(Instance $instance, bool $direct = false, bool $onlyData = false, bool $skipSystemConfigurationCheck = false, $allowCommonParents = 0)
    Severity: Minor
    Found in src/Application/Restore.php - About 35 mins to fix

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

          public function registerAccessMethod($type, $host, $user, $password = null, $port = null)
      Severity: Minor
      Found in src/Application/Instance.php - About 35 mins to fix

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

            public function __construct(string $name, string $version, SoftwareRequirement $phpVersion, SoftwareRequirement $mysqlVersion, SoftwareRequirement $mariaDBVersion)
        Severity: Minor
        Found in src/Application/Tiki/Versions/TikiRequirements.php - About 35 mins to fix

          Function remove has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              private function remove($helper, $input, $output)
              {
                  $report = new ReportManager;
                  $instances = $report->getReportInstances();
                  $instancesInfo = CommandHelper::getInstancesInfo($instances);
          Severity: Minor
          Found in src/Command/ReportManagerCommand.php - About 35 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 modify has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              private function modify($helper, $input, $output)
              {
                  $report = new ReportManager;
                  $instances = $report->getReportInstances();
                  $instancesInfo = CommandHelper::getInstancesInfo($instances);
          Severity: Minor
          Found in src/Command/ReportManagerCommand.php - About 35 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 execute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function execute(InputInterface $input, OutputInterface $output)
              {
                  $instances = CommandHelper::getInstances('tiki');
                  $instancesInfo = CommandHelper::getInstancesInfo($instances);
          
          
          Severity: Minor
          Found in src/Command/ListPatchCommand.php - About 35 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 execute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function execute(InputInterface $input, OutputInterface $output)
              {
                  $instance = new Instance();
                  try {
                      if ($input->isInteractive()) {
          Severity: Minor
          Found in src/Command/ImportInstanceCommand.php - About 35 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 setInstanceSetupError has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function setInstanceSetupError($instanceId, \Exception $e = null)
              {
                  $errors = [];
                  $io = App::get('io');
          
          
          Severity: Minor
          Found in src/Command/Helper/CommandHelper.php - About 35 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 updateInstanceTo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function updateInstanceTo($path, $branch)
              {
                  $info = $this->info($path);
                  $root = $info['repository']['root'];
                  $url = $info['url'];
          Severity: Minor
          Found in src/Repository/SVN.php - About 35 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 getFileLocations has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getFileLocations()
              {
                  $access = $this->instance->getBestAccess('scripting');
                  $webroot = rtrim($this->instance->webroot, '/');
                  $out = $access->runPHP(
          Severity: Minor
          Found in src/Application/Tiki.php - About 35 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

          Severity
          Category
          Status
          Source
          Language