TikiWiki/tiki-manager

View on GitHub

Showing 2,255 of 2,255 total issues

The class Svn has an overall complexity of 78 which is very high. The configured complexity threshold is 50.
Open

class Svn extends VersionControlSystem
{
    /*
     * @var string
     */
Severity: Minor
Found in src/Libs/VersionControl/Svn.php by phpmd

The class VersionControlSystem has 16 public methods. Consider refactoring VersionControlSystem to keep number of public methods under 10.
Open

abstract class VersionControlSystem implements LoggerAwareInterface
{
    use LoggerAwareTrait;

    protected $command;

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

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

The class Git has 23 public methods. Consider refactoring Git to keep number of public methods under 10.
Open

class Git extends VersionControlSystem
{
    protected const DEFAULT_GIT_REPOSITORY = 'https://gitlab.com/tikiwiki/tiki.git';
    protected $isDefultRepository = false;

Severity: Minor
Found in src/Libs/VersionControl/Git.php by phpmd

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

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

The class Svn has 19 public methods. Consider refactoring Svn to keep number of public methods under 10.
Open

class Svn extends VersionControlSystem
{
    /*
     * @var string
     */
Severity: Minor
Found in src/Libs/VersionControl/Svn.php by phpmd

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

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

The class Git has an overall complexity of 131 which is very high. The configured complexity threshold is 50.
Open

class Git extends VersionControlSystem
{
    protected const DEFAULT_GIT_REPOSITORY = 'https://gitlab.com/tikiwiki/tiki.git';
    protected $isDefultRepository = false;

Severity: Minor
Found in src/Libs/VersionControl/Git.php by phpmd

The class Src has 15 public methods. Consider refactoring Src to keep number of public methods under 10.
Open

class Src extends VersionControlSystem
{
    use FileArchive;

    public static $pattern = '/tiki-(.*)\.(tar\.bz2|zip|7z|tar\.gz)/';
Severity: Minor
Found in src/Libs/VersionControl/Src.php by phpmd

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

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

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

    public function sendFile($localFile, $remoteFile)
    {
        if (ApplicationHelper::isWindows()) {
            $localFile = str_replace('/', DIRECTORY_SEPARATOR, $localFile);
            $remoteFile = str_replace('/', DIRECTORY_SEPARATOR, $remoteFile);
Severity: Major
Found in src/Libs/Host/Local.php and 1 other location - About 3 hrs to fix
src/Libs/Host/Local.php on lines 140..160

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 147.

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

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

    public function receiveFile($remoteFile, $localFile)
    {
        if (ApplicationHelper::isWindows()) {
            $remoteFile = str_replace('/', DIRECTORY_SEPARATOR, $remoteFile);
            $localFile = str_replace('/', DIRECTORY_SEPARATOR, $localFile);
Severity: Major
Found in src/Libs/Host/Local.php and 1 other location - About 3 hrs to fix
src/Libs/Host/Local.php on lines 118..138

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 147.

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

Function copyDirectories has a Cognitive Complexity of 23 (exceeds 5 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 3 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 restore has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public function restore($srcInstance, $archive, $clone = false, $checksumCheck = false, $direct = false, $onlyData = false, $onlyCode = false, $options = [], $skipSystemConfigurationCheck = false, $allowCommonParents = 0)
    {
        $restore = new Restore($this, $direct, $onlyData, $skipSystemConfigurationCheck, $allowCommonParents);

        $restore->lock();
Severity: Minor
Found in src/Application/Instance.php - About 3 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 getAvailableBranches has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public function getAvailableBranches()
    {
        $versions = [];

        foreach (explode("\n", `git ls-remote --heads --tags --refs $this->repositoryUrl`) as $line) {
Severity: Minor
Found in src/Libs/VersionControl/Git.php - About 3 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

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

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $instances = CommandHelper::getInstances('no-tiki');
        $instancesInfo = CommandHelper::getInstancesInfo($instances);

Severity: Major
Found in src/Command/RestoreInstanceCommand.php - About 3 hrs to fix

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

        protected function configure()
        {
            parent::configure();
    
            $this
    Severity: Major
    Found in src/Command/UpdateInstanceCommand.php - About 3 hrs to fix

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

          protected function configure()
          {
              parent::configure();
      
              $this
      Severity: Major
      Found in src/Command/SetupCloneManagerCommand.php - About 3 hrs to fix

        Function cleanup has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function cleanup($instanceId, $instanceName, $maxBackups = 0)
            {
                $backup_directory = "{$instanceId}-{$instanceName}";
        
                $files = glob($_ENV['ARCHIVE_FOLDER'] . "/$backup_directory" . '/*.tar.bz2');
        Severity: Minor
        Found in src/Libs/Helpers/Archive.php - About 3 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

        Method readManifest has 76 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function readManifest($manifestPath)
            {
                $differentInstance = $this->instance->getId() != $this->getSourceInstance()->getId();
        
                $skipPathCheck = ($this->allowCommonParents < 0) || (count(explode('/', $this->instance->webroot)) < $this->allowCommonParents);
        Severity: Major
        Found in src/Application/Restore.php - About 3 hrs to fix

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

                          case 'r':
                              $app = $instance->getApplication();
                              $access = $instance->getBestAccess('filetransfer');
          
                              foreach ($files as $file) {
          Severity: Major
          Found in src/Libs/Helpers/Checksum.php and 1 other location - About 3 hrs to fix
          src/Libs/Helpers/Checksum.php on lines 181..199

          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 142.

          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

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

                          case 'r':
                              $app = $instance->getApplication();
                              $access = $instance->getBestAccess('filetransfer');
          
                              foreach ($files as $file) {
          Severity: Major
          Found in src/Libs/Helpers/Checksum.php and 1 other location - About 3 hrs to fix
          src/Libs/Helpers/Checksum.php on lines 246..264

          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 142.

          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

          FTP has 26 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class FTP extends Access implements Mountable
          {
              private $lastMount;
          
              public function __construct(Instance $instance)
          Severity: Minor
          Found in src/Access/FTP.php - About 3 hrs to fix

            Src has 26 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Src extends VersionControlSystem
            {
                use FileArchive;
            
                public static $pattern = '/tiki-(.*)\.(tar\.bz2|zip|7z|tar\.gz)/';
            Severity: Minor
            Found in src/Libs/VersionControl/Src.php - About 3 hrs to fix
              Severity
              Category
              Status
              Source
              Language