FriendsOfPHP/pickle

View on GitHub

Showing 57 of 59 total issues

Function load has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    public function load($path, $versionOverride = null)
    {
        if (is_file($path) === false) {
            throw new InvalidArgumentException('File not found: ' . $path);
        }
Severity: Minor
Found in src/Package/PHP/Util/XML/Loader.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

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

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        if (DIRECTORY_SEPARATOR === '\\' || $input->getOption('pack-logs')) {
            Factory::getZipperClassName(); // Be sure we have a way to zip files
        }
Severity: Minor
Found in src/Console/Command/ReleaseCommand.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 create has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public function create(array $args = [])
    {
        if (!isset($args['build']) || !($args['build'] instanceof Interfaces\Package\Build)) {
            throw new Exception('Invalid or NULL object passed as Interfaces\\Package\\Build');
        }
Severity: Minor
Found in src/Package/PHP/Command/Release/Windows/Binary.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 load has 79 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function load($path, $versionOverride = null)
    {
        if (is_file($path) === false) {
            throw new InvalidArgumentException('File not found: ' . $path);
        }
Severity: Major
Found in src/Package/PHP/Util/XML/Loader.php - About 3 hrs to fix

    Function buildOptions has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function buildOptions(Package $package, InputInterface $input, OutputInterface $output)
        {
            $helper = $this->getHelperSet()->get('question');
    
            $configureOptions = $input->getOption('with-configure-options');
    Severity: Minor
    Found in src/Base/Abstracts/Console/Command/BuildCommand.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

    Method create has 62 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function create(array $args = [])
        {
            if (!isset($args['build']) || !($args['build'] instanceof Interfaces\Package\Build)) {
                throw new Exception('Invalid or NULL object passed as Interfaces\\Package\\Build');
            }
    Severity: Major
    Found in src/Package/PHP/Command/Release/Windows/Binary.php - About 2 hrs to fix

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

          protected function execute(InputInterface $input, OutputInterface $output)
          {
              if (DIRECTORY_SEPARATOR === '\\' || $input->getOption('pack-logs')) {
                  Factory::getZipperClassName(); // Be sure we have a way to zip files
              }
      Severity: Major
      Found in src/Console/Command/ReleaseCommand.php - About 2 hrs to fix

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

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

          Function copySrcDir has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              private function copySrcDir($src, $dest)
              {
                  foreach (scandir($src) as $file) {
                      $srcfile = rtrim($src, '/') . '/' . $file;
                      $destfile = rtrim($dest, '/') . '/' . $file;
          Severity: Minor
          Found in src/Package/PHP/Command/Build/Windows.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 download has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function download($url)
              {
                  $progress = $this->progress;
                  $progress->setOverwrite(true);
                  $ctx = stream_context_create(
          Severity: Minor
          Found in src/Package/PHP/Command/Install/Windows/Binary.php - About 1 hr to fix

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

                public function resolveForBin($dll, $resolve_multiple_cb = null)
                {
                    $dep_zips = $this->getZipUrlsForDll($dll, false);
            
                    if (count($dep_zips) == 1) {
            Severity: Minor
            Found in src/Package/Util/Windows/DependencyLib.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 getCompilerFromPhpInfo has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

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

                public function getZipUrlsForDll($binary, $ignore_installed = false)
                {
                    $dll = $this->getDllsForBinary($binary);
                    $packages = [];
                    foreach ($this->dllMap as $pkg_name => $pkg) {
            Severity: Minor
            Found in src/Package/Util/Windows/DependencyLib.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 binaryInstallWindows has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function binaryInstallWindows($path, InputInterface $input, OutputInterface $output)
                {
                    Factory::getUnzipperClassName(); // Be sure we have a way to unzip files
                    $php = Engine::factory();
                    $table = new Table($output);
            Severity: Minor
            Found in src/Console/Command/InstallerCommand.php - About 1 hr to fix

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

                  protected function buildOptions(Package $package, InputInterface $input, OutputInterface $output)
                  {
                      $helper = $this->getHelperSet()->get('question');
              
                      $configureOptions = $input->getOption('with-configure-options');
              Severity: Minor
              Found in src/Base/Abstracts/Console/Command/BuildCommand.php - About 1 hr to fix

                Function __construct has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function __construct(Interfaces\Package $package)
                    {
                        $dir = $package->getSourceDir();
                        $path = $package->getSourceDir() . '/.gitignore';
                        $this->excluded = glob("{$dir}/.git/*");
                Severity: Minor
                Found in src/Base/Util/GitIgnore.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 prepare has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function prepare()
                    {
                        $matches = null;
                        if (Type::determinePickle($this->path, $matches) < 1) {
                            throw new Exception('Not a pickle git URI');
                Severity: Minor
                Found in src/Package/Convey/Command/Pickle.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 composerJsonBak has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function composerJsonBak(Interfaces\Package $pkg, $restore = false)
                    {
                        $composer_json_orig = $pkg->getRootDir() . DIRECTORY_SEPARATOR . 'composer.json';
                        $composer_json_bak = $pkg->getRootDir() . DIRECTORY_SEPARATOR . '.composer.json.orig';
                
                
                Severity: Minor
                Found in src/Package/PHP/Command/Release/Windows/Binary.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 prepareConfigOpts has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function prepareConfigOpts()
                    {
                        $configureOptions = '';
                        foreach ($this->options as $name => $option) {
                            if ($option->type === 'enable') {
                Severity: Minor
                Found in src/Package/PHP/Command/Build/Unix.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 configure has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function configure()
                    {
                        $this
                            ->addArgument(
                                'path',
                Severity: Minor
                Found in src/Base/Abstracts/Console/Command/BuildCommand.php - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language