FriendsOfPHP/pickle

View on GitHub

Showing 57 of 59 total issues

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

    public static function readPackage($path, $noconvert)
    {
        $jsonLoader = new Package\Util\JSON\Loader(new Package\Util\Loader());
        $package = null;

Severity: Minor
Found in src/Package/PHP/Util/PackageJson.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 addFromString has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function addFromString(string $localname, string $contents): void
    {
        $localname = ltrim(str_replace(DIRECTORY_SEPARATOR, '/', $localname), '/');
        $this->createTempDir();
        $tempDir = $this->getTempDir();
Severity: Minor
Found in src/Base/Archive/InfozipZipper.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 determine has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function determine($path, $remote)
    {
        if (substr($path, -4) == '.tgz' || substr($path, -7) == '.tar.gz') {
            return self::TGZ;
        }
Severity: Minor
Found in src/Package/Convey/Command/Type.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 getLog has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getLog($hint = null)
    {
        $ret = [];

        foreach ($this->log as $item) {
Severity: Minor
Found in src/Base/Abstracts/Package/Build.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 cleanup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function cleanup()
    {
        if (is_dir($this->tempDir)) {
            $iterator = new RecursiveIteratorIterator(
                new RecursiveDirectoryIterator(
Severity: Minor
Found in src/Base/Util/FileOps.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 new SrcDir($path, $io);
Severity: Major
Found in src/Package/Convey/Command/Factory.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                return self::PICKLE;
    Severity: Major
    Found in src/Package/Convey/Command/Type.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return self::ANY;
      Severity: Major
      Found in src/Package/Convey/Command/Type.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return new Any($path, $io);
        Severity: Major
        Found in src/Package/Convey/Command/Factory.php - About 30 mins to fix

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

              private function create(bool $overwrite): void
              {
                  if (file_exists($this->path)) {
                      if ($overwrite === false) {
                          throw new RuntimeException("The ZIP archive {$this->path} already exists");
          Severity: Minor
          Found in src/Base/Archive/InfozipZipper.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 getExtensionDirFromPhpInfo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function getExtensionDirFromPhpInfo($info)
              {
                  $extensionDir = '';
          
                  foreach ($info as $s) {
          Severity: Minor
          Found in src/Engine/PHP.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 getMultiExtensionNames has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getMultiExtensionNames()
              {
                  $info = $this->build->getInfo();
                  $ext_names = [$info['name']];
          
          
          Severity: Minor
          Found in src/Package/PHP/Command/Release/Windows/Binary.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 set has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function set($tmpDir, $create = false)
              {
                  if (!$create) {
                      if (!is_dir($tmpDir)) {
                          throw new Exception("Directory '{$tmpDir}' does not exist");
          Severity: Minor
          Found in src/Base/Util/TmpDir.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 dump has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function dump(Interfaces\Package $package, $with_version = true)
              {
                  $data = [];
          
                  $data['name'] = $package->getPrettyName();
          Severity: Minor
          Found in src/Package/Util/Dumper.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 packLog has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function packLog($path)
              {
                  $zipperClass = Archive\Factory::getZipperClassName();
                  $zip = new $zipperClass($path, Interfaces\Archive\Zipper::FLAG_CREATE_OVERWRITE);
                  /** @var \Pickle\Base\Interfaces\Archive\Zipper $zip */
          Severity: Minor
          Found in src/Base/Abstracts/Package/Build.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 prepareConfigOpts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function prepareConfigOpts()
              {
                  $configureOptions = '--enable-debug-pack';
                  foreach ($this->options as $name => $option) {
                      $decision = null;
          Severity: Minor
          Found in src/Package/PHP/Command/Build/Windows.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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function create(array $args = [])
              {
                  $archBasename = $this->pkg->getSimpleName() . '-' . $this->pkg->getPrettyVersion();
          
                  /* Work around bug  #67417 [NEW]: ::compress modifies archive basename
          Severity: Minor
          Found in src/Package/PHP/Command/Release.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