repman-io/repman

View on GitHub

Showing 85 of 140 total issues

File DbalPackageQuery.php has 419 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

namespace Buddy\Repman\Query\User\PackageQuery;
Severity: Minor
Found in src/Query/User/PackageQuery/DbalPackageQuery.php - About 6 hrs to fix

    Function synchronize has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

        public function synchronize(Package $package): void
        {
            try {
                $io = $this->createIO($package);
                /** @var RepositoryInterface $repository */
    Severity: Minor
    Found in src/Service/PackageSynchronizer/ComposerPackageSynchronizer.php - About 5 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 synchronize has 128 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function synchronize(Package $package): void
        {
            try {
                $io = $this->createIO($package);
                /** @var RepositoryInterface $repository */
    Severity: Major
    Found in src/Service/PackageSynchronizer/ComposerPackageSynchronizer.php - About 5 hrs to fix

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

      class Package
      {
          const NAME_PATTERN = '/^[a-z0-9]([_.-]?[a-z0-9]+)*\/[a-z0-9]([_.-]?[a-z0-9]+)*$/';
      
          /**
      Severity: Minor
      Found in src/Entity/Organization/Package.php - About 4 hrs to fix

        File OrganizationController.php has 286 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        declare(strict_types=1);
        
        namespace Buddy\Repman\Controller;
        Severity: Minor
        Found in src/Controller/OrganizationController.php - About 2 hrs to fix

          User has 25 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class User
          {
              const STATUS_ENABLED = 'enabled';
          
              const STATUS_DISABLED = 'disabled';
          Severity: Minor
          Found in src/Entity/User.php - About 2 hrs to fix

            File PackageController.php has 279 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            declare(strict_types=1);
            
            namespace Buddy\Repman\Controller\Api;
            Severity: Minor
            Found in src/Controller/Api/PackageController.php - About 2 hrs to fix

              File Proxy.php has 272 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              declare(strict_types=1);
              
              namespace Buddy\Repman\Service;
              Severity: Minor
              Found in src/Service/Proxy.php - About 2 hrs to fix

                File PackageController.php has 263 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                declare(strict_types=1);
                
                namespace Buddy\Repman\Controller\Organization;
                Severity: Minor
                Found in src/Controller/Organization/PackageController.php - About 2 hrs to fix

                  Method findAll has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function findAll(string $organizationId, Filter $filter): array
                      {
                          $filterSQL = $joinSQL = '';
                          $params = [
                              'organization_id' => $organizationId,
                  Severity: Major
                  Found in src/Query/User/PackageQuery/DbalPackageQuery.php - About 2 hrs to fix

                    Organization has 21 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class Organization
                    {
                        /**
                         * @ORM\Id
                         * @ORM\Column(type="uuid", unique=true)
                    Severity: Minor
                    Found in src/Entity/Organization.php - About 2 hrs to fix

                      Function voteOnAttribute has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function voteOnAttribute(string $attribute, $subject, TokenInterface $token): bool
                          {
                              /**
                               * @var User
                               */
                      Severity: Minor
                      Found in src/Service/Organization/OrganizationVoter.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 packageNew has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function packageNew(Organization $organization, Request $request, ?string $type): Response
                          {
                              $form = $this->createForm(AddPackageType::class);
                              $form->get('formUrl')->setData($this->generateUrl(
                                  $request->attributes->get('_route'),
                      Severity: Major
                      Found in src/Controller/Organization/PackageController.php - About 2 hrs to fix

                        Method __construct has 15 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                string $id,
                                string $organizationId,
                                string $type,
                                string $url,
                                ?string $name = null,
                        Severity: Major
                        Found in src/Query/User/Model/Package.php - About 1 hr to fix

                          Method buildForm has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function buildForm(FormBuilderInterface $builder, array $options): void
                              {
                                  $builder
                                      ->add('email', EmailType::class, [
                                          'constraints' => [
                          Severity: Minor
                          Found in src/Form/Type/User/RegisterType.php - About 1 hr to fix

                            Method buildForm has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function buildForm(FormBuilderInterface $builder, array $options): void
                                {
                                    $builder
                                        ->add('local_authentication', ChoiceType::class, [
                                            'choices' => [
                            Severity: Minor
                            Found in src/Form/Type/Admin/ConfigType.php - About 1 hr to fix

                              Function updateLatestProvider has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private function updateLatestProvider(array $files): void
                                  {
                                      $latest = [];
                                      foreach ($files as $file) {
                                          \preg_match('/(?<name>.+)\$/', $file['filename'], $matches);
                              Severity: Minor
                              Found in src/Service/Proxy.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 updateLatestProvider has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  private function updateLatestProvider(array $files): void
                                  {
                                      $latest = [];
                                      foreach ($files as $file) {
                                          \preg_match('/(?<name>.+)\$/', $file['filename'], $matches);
                              Severity: Minor
                              Found in src/Service/Proxy.php - About 1 hr to fix

                                Method up has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function up(Schema $schema): void
                                    {
                                        $this->abortIf(!$this->connection->getDatabasePlatform() instanceof PostgreSQLPlatform, 'Migration can only be executed safely on \'postgresql\'.');
                                
                                        $this->addSql('CREATE TABLE organization (id UUID NOT NULL, owner_id UUID NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, name VARCHAR(255) NOT NULL, alias VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
                                Severity: Minor
                                Found in src/Migrations/Version20200312091436.php - About 1 hr to fix

                                  Method __construct has 13 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                          string $id,
                                          string $type,
                                          string $url,
                                          ?string $name = null,
                                          ?string $latestReleasedVersion = null,
                                  Severity: Major
                                  Found in src/Query/Api/Model/Package.php - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language