repman-io/repman

View on GitHub

Showing 85 of 140 total issues

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

    Method profile has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function profile(Request $request): Response
        {
            $this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED');
            $oauthTokens = $this->userQuery->findAllOAuthTokens($this->getUser()->id());
    
    
    Severity: Minor
    Found in src/Controller/UserController.php - About 1 hr to fix

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

          public function buildForm(FormBuilderInterface $builder, array $options): void
          {
              $builder
                  ->add('formUrl', HiddenType::class, [
                      'attr' => ['class' => 'addPackageFormUrl'],
      Severity: Minor
      Found in src/Form/Type/Organization/AddPackageType.php - About 1 hr to fix

        Method packages has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function packages(string $organizationId, \DateTimeImmutable $till, int $limit = 100, int $offset = 0): array
            {
                return array_map(function (array $data): Package {
                    return new Package(
                        $data['type'],
        Severity: Minor
        Found in src/Query/Admin/TelemetryQuery/DbalTelemetryQuery.php - About 1 hr to fix

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

              public function __construct(string $id, string $email, string $password, string $status, bool $emailConfirmed, string $emailConfirmToken, $roles, $organizations, bool $emailScanResult, string $timezone)
          Severity: Major
          Found in src/Security/Model/User.php - About 1 hr to fix

            Method scan has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function scan(Package $package): void
                {
                    $packageName = $package->name();
                    $result = [];
                    $status = ScanResult::STATUS_OK;
            Severity: Minor
            Found in src/Service/Security/PackageScanner/SensioLabsPackageScanner.php - About 1 hr to fix

              Method register has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function register(Request $request): Response
                  {
                      $this->ensureRegistrationIsEnabled();
              
                      $form = $this->createForm(RegisterType::class);
              Severity: Minor
              Found in src/Controller/RegistrationController.php - About 1 hr to fix

                Method findDistribution has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function findDistribution(Package $package): string
                    {
                        $packageName = $package->name();
                        $latestReleasedVersion = $package->latestReleasedVersion();
                
                
                Severity: Minor
                Found in src/Service/Security/PackageScanner/SensioLabsPackageScanner.php - About 1 hr to fix

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

                          string $type,
                          ?\DateTimeImmutable $lastRelease,
                          ?\DateTimeImmutable $lastSync,
                          ?\DateTimeImmutable $lastScan,
                          bool $hasError,
                  Severity: Major
                  Found in src/Service/Telemetry/Entry/Package.php - About 1 hr to fix

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

                        private function getAdvisories(): array
                        {
                            $advisories = [];
                            foreach ($this->getDatabase() as $file) {
                                if (!$file->isFile() || $file->getExtension() !== 'yaml') {
                    Severity: Minor
                    Found in src/Service/Security/SecurityChecker/SensioLabsSecurityChecker.php - About 1 hr to fix

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

                          public function getDetailsById(string $id): Option
                          {
                              $data = $this->connection->fetchAssociative(
                                  'SELECT
                                      id,
                      Severity: Minor
                      Found in src/Query/User/PackageQuery/DbalPackageQuery.php - About 1 hr to fix

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

                            public function findAll(string $organizationId, int $limit = 20, int $offset = 0): array
                            {
                                return array_map(function (array $data): Package {
                                    return $this->hydratePackage($data);
                                    }, $this->connection->fetchAllAssociative(
                        Severity: Minor
                        Found in src/Query/Api/PackageQuery/DbalPackageQuery.php - About 1 hr to fix

                          Function syncSuccess has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function syncSuccess(string $name, string $description, string $latestReleasedVersion, array $encounteredVersions, array $encounteredLinks, \DateTimeImmutable $latestReleaseDate): void
                              {
                                  $this->setName($name);
                                  $this->description = $description;
                                  $this->latestReleasedVersion = $latestReleasedVersion;
                          Severity: Minor
                          Found in src/Entity/Organization/Package.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 getAdvisories has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private function getAdvisories(): array
                              {
                                  $advisories = [];
                                  foreach ($this->getDatabase() as $file) {
                                      if (!$file->isFile() || $file->getExtension() !== 'yaml') {
                          Severity: Minor
                          Found in src/Service/Security/SecurityChecker/SensioLabsSecurityChecker.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 organizations has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function organizations(int $limit = 100, int $offset = 0): array
                              {
                                  return array_map(function (array $data): Organization {
                                      return new Organization(
                                          $data['id'],
                          Severity: Minor
                          Found in src/Query/Admin/TelemetryQuery/DbalTelemetryQuery.php - About 1 hr to fix

                            Method getById has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function getById(string $id): Option
                                {
                                    $data = $this->connection->fetchAssociative(
                                        'SELECT
                                            id,
                            Severity: Minor
                            Found in src/Query/User/PackageQuery/DbalPackageQuery.php - About 1 hr to fix

                              Method settings has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function settings(Organization $organization, Request $request): Response
                                  {
                                      $renameForm = $this->createForm(ChangeNameType::class, ['name' => $organization->name()]);
                                      $renameForm->handleRequest($request);
                                      if ($renameForm->isSubmitted() && $renameForm->isValid()) {
                              Severity: Minor
                              Found in src/Controller/OrganizationController.php - About 1 hr to fix

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

                                    public function getById(string $organizationId, string $id): Option
                                    {
                                        $data = $this->connection->fetchAssociative(
                                            'SELECT
                                                id,
                                Severity: Minor
                                Found in src/Query/Api/PackageQuery/DbalPackageQuery.php - About 1 hr to fix

                                  Function distribution has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public function distribution(string $package, string $version, string $ref, string $format): Option
                                      {
                                          $path = $this->distPath($package, $ref, $format);
                                          if (!$this->filesystem->has($path)) {
                                              foreach ($this->decodeMetadata($package) as $packageData) {
                                  Severity: Minor
                                  Found in src/Service/Proxy.php - About 55 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 download has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public function download(string $package, string $version): void
                                      {
                                          $lastDist = null;
                                  
                                          foreach ($this->decodeMetadata($package) as $packageData) {
                                  Severity: Minor
                                  Found in src/Service/Proxy.php - About 55 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