TikiWiki/tiki-manager

View on GitHub

Showing 2,255 of 2,255 total issues

Method copyDirectories has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function copyDirectories($targets, $backupDir)
    {
        $access = $this->getAccess();
        $backupDir = $backupDir ?: $this->backupDir;
        $result = [];
Severity: Minor
Found in src/Application/Backup.php - About 1 hr to fix

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

        public function rsync($args = [])
        {
            $return_val = -1;
            if (empty($args['src']) || empty($args['dest'])) {
                return $return_val;
    Severity: Minor
    Found in src/Libs/Host/SSH.php - About 1 hr to fix

      Function interact has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function interact(InputInterface $input, OutputInterface $output)
          {
              $instances = CommandHelper::getInstances('tiki');
              $instances = array_filter($instances, function ($instance) {
                  return $instance->vcs_type == 'git';
      Severity: Minor
      Found in src/Command/CheckoutCommand.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 getLocalCheckouts has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getLocalCheckouts()
          {
              $access = $this->instance->getBestAccess('scripting');
              $access->chdir($this->instance->webroot);
              $adjustedFindCmd = $access->executeWithPriorityParams('find');
      Severity: Minor
      Found in src/Application/Tiki.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 getPassword has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      function getPassword($stars = false)
      {
          // Get current style
          $oldStyle = shell_exec('stty -g');
      
      
      Severity: Minor
      Found in src/Libs/Helpers/functions.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 interact has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function interact(InputInterface $input, OutputInterface $output)
          {
              $this->io->note('Backups are only available on Local and SSH instances.');
      
              $instances = CommandHelper::getInstances('all', true);
      Severity: Minor
      Found in src/Command/BackupInstanceCommand.php - About 1 hr to fix

        Method getInstancesInfo has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function getInstancesInfo(array $instances, bool $all_infos = false): ?array
            {
                $instancesInfo = null;
        
                foreach ($instances as $instance) {
        Severity: Minor
        Found in src/Command/Helper/CommandHelper.php - About 1 hr to fix

          Method configure has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function configure()
              {
                  parent::configure();
          
                  $this
          Severity: Minor
          Found in src/Command/ApplyPatchCommand.php - About 1 hr to fix

            Method configure has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function configure()
                {
                    parent::configure();
            
                    $this
            Severity: Minor
            Found in src/Command/SetupSchedulerCronInstanceCommand.php - About 1 hr to fix

              Method interact has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function interact(InputInterface $input, OutputInterface $output)
                  {
                      $instances = CommandHelper::getInstances('all', true);
                      $instancesInfo = CommandHelper::getInstancesInfo($instances);
              
              
              Severity: Minor
              Found in src/Command/SetupSchedulerCronInstanceCommand.php - About 1 hr to fix

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                    public function createCommand($bin, $args = [], $stdin = '')
                    {
                        $options = [];
                
                        if ($this->location) {
                Severity: Major
                Found in src/Access/Local.php and 1 other location - About 1 hr to fix
                src/Access/SSH.php on lines 390..405

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 113.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                    public function createCommand($bin, $args = [], $stdin = '')
                    {
                        $options = [];
                
                        if ($this->location) {
                Severity: Major
                Found in src/Access/SSH.php and 1 other location - About 1 hr to fix
                src/Access/Local.php on lines 385..400

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 113.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Method getSVNPath has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getSVNPath()
                    {
                        $host = $this->getHost();
                
                        $sets = [
                Severity: Minor
                Found in src/Access/SSH.php - About 1 hr to fix

                  Method restoreDatabase has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function restoreDatabase(Database $database, string $remoteFile, bool $clone)
                      {
                          $tmp = tempnam($_ENV['TEMP_FOLDER'], 'dblocal');
                  
                          if (! empty($database->dbLocalContent)) {
                  Severity: Minor
                  Found in src/Application/Tiki.php - About 1 hr to fix

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

                        public static function validateInstanceSelection($answer, $allInstances)
                        {
                            if (empty($answer)) {
                                throw new \RuntimeException(
                                    'You must select an instance #ID'
                    Severity: Minor
                    Found in src/Command/Helper/CommandHelper.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 interact has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function interact(InputInterface $input, OutputInterface $output)
                        {
                    
                            if (empty($input->getOption('instance'))) {
                                if (empty($this->instancesInfo)) {
                    Severity: Minor
                    Found in src/Command/TagDeleteCommand.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 setupDatabase has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function setupDatabase(Instance $instance, $reconfigure = false): Instance
                        {
                            try {
                                if (!$reconfigure && $this->testExistingDbConnection($instance)) {
                                    return $instance;
                    Severity: Minor
                    Found in src/Command/Traits/InstanceConfigure.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 detectPHPMacOS has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function detectPHPMacOS($options = [], $searchOrder = null)
                        {
                            if ($searchOrder === null) {
                                $searchOrder = [
                                    ['command', ['-v', 'php']],
                    Severity: Minor
                    Found in src/Application/Discovery/MacOSDiscovery.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 postInstall has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function postInstall(array $options = [])
                        {
                            $access = $this->instance->getBestAccess('scripting');
                            $access->getHost(); // trigger the config of the location change (to catch phpenv)
                    
                    
                    Severity: Minor
                    Found in src/Application/Tiki.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 info has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function info($path, $args = [])
                        {
                            if (empty($args)) {
                                $args = $this->getDefaultArgs('info');
                            }
                    Severity: Minor
                    Found in src/Repository/SVN.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

                    Severity
                    Category
                    Status
                    Source
                    Language