ahilles107/updater

View on GitHub

Showing 11 of 11 total issues

Function includeConfigDir has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    public function includeConfigDir($configDir)
    {
        $fileMapping = $this->package->getFilemapping();
        $finder = new Finder();
        if (!is_null($configDir) && !empty($configDir)) {
Severity: Minor
Found in src/Updater/Service/UpdateService.php - About 2 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 getSpecFromZip has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function getSpecFromZip($packagesDir, $zipFileName = null)
    {
        $jsonManager = new JsonManager($packagesDir);
        $packages = array();

Severity: Minor
Found in src/Updater/Tools/Files/FilesManager.php - About 2 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

Package has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

class Package
{
    /**
     * Version name.
     *
Severity: Minor
Found in src/Updater/Package/Package.php - About 2 hrs to fix

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

        public function execute(InputInterface $input, OutputInterface $output)
        {
            $filePath = $input->getArgument('file');
    
            if (!file_exists($filePath)) {
    Severity: Minor
    Found in src/Updater/Command/ValidateCommand.php - About 1 hr to fix

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

          public function execute(InputInterface $input, OutputInterface $output)
          {
              $tempDir = $input->getArgument('temp_dir');
              $targetDir = $input->getArgument('target');
              $packageDir = $input->getArgument('package_dir');
      Severity: Minor
      Found in src/Updater/Command/UpdateCommand.php - About 1 hr to fix

        Method includeConfigDir has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function includeConfigDir($configDir)
            {
                $fileMapping = $this->package->getFilemapping();
                $finder = new Finder();
                if (!is_null($configDir) && !empty($configDir)) {
        Severity: Minor
        Found in src/Updater/Service/UpdateService.php - About 1 hr to fix

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

              private function copyFiles(array $file, $rollback = false)
              {
                  $fileSystem = new Filesystem();
                  $dir = FilesManager::NEW_FILES_DIR;
                  if ($rollback) {
          Severity: Minor
          Found in src/Updater/Service/UpdateService.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 createJsonContentFrom has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              private function createJsonContentFrom($schema, array $arguments)
              {
                  $decodedSchema = json_decode($schema, true);
                  $fileMapping = $this->getFileContent($arguments['version'].'.txt', $arguments['target']);
                  $jsonContent = array();
          Severity: Minor
          Found in src/Updater/Tools/Files/FilesManager.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 execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function execute(InputInterface $input, OutputInterface $output)
              {
                  $filePath = $input->getArgument('file');
          
                  if (!file_exists($filePath)) {
          Severity: Minor
          Found in src/Updater/Command/ValidateCommand.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 generateParameters has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              private function generateParameters($commandLine, array $arguments)
              {
                  if (isset($arguments['comparePath']) && !empty($arguments['comparePath'])) {
                      $commandLine .= ' -d '.$arguments['comparePath'];
                  }
          Severity: Minor
          Found in src/Updater/Command/GeneratePackageCommand.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 copyFilesToTemp has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function copyFilesToTemp()
              {
                  $fileSystem = new Filesystem();
                  $fileMapping = $this->includeConfigDir($this->package->getInclude());
                  if (empty($fileMapping)) {
          Severity: Minor
          Found in src/Updater/Service/UpdateService.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