TikiWiki/tiki-manager

View on GitHub

Showing 2,255 of 2,255 total issues

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

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

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 setSafeDirectory has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    private function setSafeDirectory($instance)
    {
        $skipSafeDir = isset($_ENV['GIT_DONT_ADD_SAFEDIR']) ? (bool) $_ENV['GIT_DONT_ADD_SAFEDIR'] : false;

        if ($skipSafeDir) {
Severity: Minor
Found in src/Libs/VersionControl/Git.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 install has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function install(Version $version, $checksumCheck = false, $revision = null)
    {
        $access = $this->instance->getBestAccess('scripting');
        $host = $access->getHost();

Severity: Minor
Found in src/Application/Tiki.php - About 1 hr to fix

    Method setSafeDirectory has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function setSafeDirectory($instance)
        {
            $skipSafeDir = isset($_ENV['GIT_DONT_ADD_SAFEDIR']) ? (bool) $_ENV['GIT_DONT_ADD_SAFEDIR'] : false;
    
            if ($skipSafeDir) {
    Severity: Minor
    Found in src/Libs/VersionControl/Git.php - About 1 hr to fix

      Method setupRemoteAccess has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function setupRemoteAccess(Access $access)
          {
              $host = $this->io->ask('Host', $this->input->getOption('host') ?? '', function ($value) {
                  return !empty($value) ? $value : new InvalidOptionException("You must provide a valid remote host. Please use --host=<HOST>");
              });
      Severity: Minor
      Found in src/Command/Traits/InstanceConfigure.php - About 1 hr to fix

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

            protected function interact(InputInterface $input, OutputInterface $output)
            {
                if (empty($input->getOption('instance'))) {
                    if (empty($this->instancesInfo)) {
                        return;
        Severity: Minor
        Found in src/Command/TagAddOrEditCommand.php - About 1 hr to fix

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

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

            Method windowsSync has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function windowsSync($remoteLocation, $localMirror, $files = [], $exclusions = [])
                {
            
                    $exclude = '';
                    $returnVar = 0;
            Severity: Minor
            Found in src/Libs/Host/Local.php - About 1 hr to fix

              The class Instance has 25 fields. Consider redesigning Instance to keep the number of fields under 15.
              Open

              class Instance
              {
                  const TYPES = 'local,ftp,ssh';
              
                  const SQL_SELECT_INSTANCE = <<<SQL
              Severity: Minor
              Found in src/Application/Instance.php by phpmd

              TooManyFields

              Since: 0.1

              Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

              Example

              class Person {
                 protected $one;
                 private $two;
                 private $three;
                 [... many more fields ...]
              }

              Source https://phpmd.org/rules/codesize.html#toomanyfields

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

                  protected function interact(InputInterface $input, OutputInterface $output)
                  {
                      if (empty($input->getOption('time'))) {
                          $answer = $this->io->ask('What time should it run at?', '00:00', function ($answer) {
                              return CommandHelper::validateTimeInput($answer);
              Severity: Minor
              Found in src/Command/SetupBackupManagerCommand.php - About 1 hr to fix

                Method execute has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function execute(InputInterface $input, OutputInterface $output)
                    {
                        $time = $input->getOption('time');
                        list($hours, $minutes) = CommandHelper::validateTimeInput($time);
                        $arguments = '--instances=all --no-interaction';
                Severity: Minor
                Found in src/Command/SetupBackupManagerCommand.php - About 1 hr to fix

                  Method execute has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function execute(InputInterface $input, OutputInterface $output)
                      {
                          $instance = Instance::getInstance($input->getOption('instance'));
                          if (empty($instance)) {
                              $this->io->warning('No Tiki instances available.');
                  Severity: Minor
                  Found in src/Command/CreateTemporaryUserInstanceCommand.php - About 1 hr to fix

                    Method execute has 36 lines of code (exceeds 25 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 1 hr to fix

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

                          protected function interact(InputInterface $input, OutputInterface $output)
                          {
                              $helper = $this->getHelper('question');
                              $email = $input->getOption('email');
                              if (empty($email) || ! filter_var($email, FILTER_VALIDATE_EMAIL)) {
                      Severity: Minor
                      Found in src/Command/SetupWatchManagerCommand.php - About 1 hr to fix

                        Method handleInstance has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function handleInstance(Instance $instance, InputInterface $input): Instance\CronJob
                            {
                                $this->io->section($instance->name);
                        
                                $instanceOS = $instance->getDiscovery()->detectOS();
                        Severity: Minor
                        Found in src/Command/SetupSchedulerCronInstanceCommand.php - About 1 hr to fix

                          Method fixPermissions has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function fixPermissions($path)
                              {
                                  $filesystem = new Filesystem();
                                  $perm = $this->getFilePerm();
                                  $user = $this->getFileUser();
                          Severity: Minor
                          Found in src/Application/Backup.php - About 1 hr to fix

                            Method decompressArchive has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function decompressArchive($folder, $archive)
                                {
                                    $access = $this->access;
                            
                                    $bzipStep = false;
                            Severity: Minor
                            Found in src/Application/Restore.php - About 1 hr to fix

                              Method extractTo has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function extractTo(Version $version, $folder, $revision = null): void
                                  {
                                      $dirExists = file_exists($folder);
                              
                                      if ($dirExists && preg_match('/tags\\//', $version->branch)) {
                              Severity: Minor
                              Found in src/Application/Tiki.php - About 1 hr to fix

                                Method fixPermissions has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function fixPermissions()
                                    {
                                        $instance = $this->instance;
                                        $access = $instance->getBestAccess('scripting');
                                
                                
                                Severity: Minor
                                Found in src/Application/Tiki.php - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language