Beyond-IT/ocok

View on GitHub

Showing 14 of 16 total issues

Function execute has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output) {
        if (parent::execute($input, $output)) {
            $file_system_helper = new FileSystem();

            $this->loadOCConfig();
Severity: Minor
Found in src/BeyondIT/OCOK/BackupCommand.php - About 4 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 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output) {
        $fsh = new FileSystem();
        $dir = getcwd();

        $installer = new Installer($dir . DIRECTORY_SEPARATOR);
Severity: Major
Found in src/BeyondIT/OCOK/InstallCommand.php - About 2 hrs to fix

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

        protected function execute(InputInterface $input, OutputInterface $output) {
            if (parent::execute($input, $output)) {
                $file_system_helper = new FileSystem();
    
                $this->loadOCConfig();
    Severity: Minor
    Found in src/BeyondIT/OCOK/BackupCommand.php - About 1 hr to fix

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

          protected function execute(InputInterface $input, OutputInterface $output) {
              $fsh = new FileSystem();
              $dir = getcwd();
      
              $installer = new Installer($dir . DIRECTORY_SEPARATOR);
      Severity: Minor
      Found in src/BeyondIT/OCOK/InstallCommand.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 execute has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function execute(InputInterface $input, OutputInterface $output) {
              if (parent::execute($input, $output)) {
                                  
                  if (!$input->getOption("catalog")) {
                      chdir('admin');  
      Severity: Minor
      Found in src/BeyondIT/OCOK/CliTaskCommand.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 execute has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function execute(InputInterface $input, OutputInterface $output) {
              if (parent::execute($input, $output)) {          
                  
                  $this->loadOCConfig();
                  
      Severity: Minor
      Found in src/BeyondIT/OCOK/PHPDocCommand.php - About 1 hr to fix

        Avoid deeply nested control flow statements.
        Open

                                    if (substr($file->getPathname(), 0, strlen($this->getOCDirectory())) == $this->getOCDirectory()) {
                                        $path = substr($file->getPathname(), strlen($this->getOCDirectory()));
                                    }
        Severity: Major
        Found in src/BeyondIT/OCOK/BackupCommand.php - About 45 mins to fix

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

              public function unzip() {
                  if (is_file($this->oc_zip)) {
                      $za = new \ZipArchive();
                      $za->open($this->oc_zip);
          
          
          Severity: Minor
          Found in src/BeyondIT/OCOK/Helpers/Downloader.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 loadVersion has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function loadVersion($execDir) {
                  $output = false;
                  
                  $handle = fopen($execDir .DIRECTORY_SEPARATOR. $this->files['catalog/index'], "r");
                  if ($handle) {
          Severity: Minor
          Found in src/BeyondIT/OCOK/OCOKCommand.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

          Avoid too many return statements within this method.
          Open

                      return;
          Severity: Major
          Found in src/BeyondIT/OCOK/InstallCommand.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return;
            Severity: Major
            Found in src/BeyondIT/OCOK/InstallCommand.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return;
              Severity: Major
              Found in src/BeyondIT/OCOK/InstallCommand.php - About 30 mins to fix

                Function removeConfigFiles has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function removeConfigFiles() {
                        if ($this->dir_opencart) {
                            $directory = $this->dir_opencart;
                        } else {
                            $directory = getcwd();
                Severity: Minor
                Found in src/BeyondIT/OCOK/Helpers/Installer.php - About 25 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 process has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function process($version) {
                        $check = $this->download($version);
                
                        if ($check) {
                            $check = $this->unzip();
                Severity: Minor
                Found in src/BeyondIT/OCOK/Helpers/Downloader.php - About 25 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