Covivo/mobicoop

View on GitHub

Showing 1,607 of 1,615 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                        case self::MULTI_MATCHES_FOR_SAME_CANDIDATES_SHORTEST:
                            usort($matchesPassenger, self::build_sorter('newDistance'));
                            $matching = new Matching();
                            $matching->setProposalOffer($this->proposalRepository->find($candidateId));
                            $matching->setProposalRequest($proposal);
Severity: Major
Found in api/src/Carpool/Service/ProposalMatcher.php and 1 other location - About 1 day to fix
api/src/Carpool/Service/ProposalMatcher.php on lines 548..567

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 274.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Ask has 64 functions (exceeds 20 allowed). Consider refactoring.
Open

class Ask
{
    public const STATUS_INITIATED = 1;
    public const STATUS_PENDING_AS_DRIVER = 2;
    public const STATUS_PENDING_AS_PASSENGER = 3;
Severity: Major
Found in api/src/Carpool/Entity/Ask.php - About 1 day to fix

    Event has 63 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Event
    {
        public const STATUS_PENDING = 0;
        public const STATUS_ACTIVE = 1;
        public const STATUS_INACTIVE = 2;
    Severity: Major
    Found in api/src/Event/Entity/Event.php - About 1 day to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                          $carpool['carpoolerSchedule'] = [
                              'mon' => $solidaryMatching->getMatching()->getProposalOffer()->getCriteria()->isMonCheck() ? $solidaryMatching->getMatching()->getProposalOffer()->getCriteria()->getMonTime() : false,
                              'tue' => $solidaryMatching->getMatching()->getProposalOffer()->getCriteria()->isTueCheck() ? $solidaryMatching->getMatching()->getProposalOffer()->getCriteria()->getTueTime() : false,
                              'wed' => $solidaryMatching->getMatching()->getProposalOffer()->getCriteria()->isWedCheck() ? $solidaryMatching->getMatching()->getProposalOffer()->getCriteria()->getWedTime() : false,
                              'thu' => $solidaryMatching->getMatching()->getProposalOffer()->getCriteria()->isThuCheck() ? $solidaryMatching->getMatching()->getProposalOffer()->getCriteria()->getThuTime() : false,
      Severity: Major
      Found in api/src/Solidary/Admin/Service/SolidaryManager.php and 1 other location - About 1 day to fix
      api/src/Solidary/Admin/Service/SolidaryManager.php on lines 661..669

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 269.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                          $asolution['schedule'][$way] = [
                              'mon' => $solution->getSolidaryMatching()->getMatching()->getCriteria()->isMonCheck() ? $solution->getSolidaryMatching()->getMatching()->getCriteria()->getMonTime() : false,
                              'tue' => $solution->getSolidaryMatching()->getMatching()->getCriteria()->isTueCheck() ? $solution->getSolidaryMatching()->getMatching()->getCriteria()->getTueTime() : false,
                              'wed' => $solution->getSolidaryMatching()->getMatching()->getCriteria()->isWedCheck() ? $solution->getSolidaryMatching()->getMatching()->getCriteria()->getWedTime() : false,
                              'thu' => $solution->getSolidaryMatching()->getMatching()->getCriteria()->isThuCheck() ? $solution->getSolidaryMatching()->getMatching()->getCriteria()->getThuTime() : false,
      Severity: Major
      Found in api/src/Solidary/Admin/Service/SolidaryManager.php and 1 other location - About 1 day to fix
      api/src/Solidary/Admin/Service/SolidaryManager.php on lines 286..294

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 269.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      <?php
      
      /**
       * Copyright (c) 2018, MOBICOOP. All rights reserved.
       * This project is dual licensed under AGPL and proprietary licence.
      Severity: Major
      Found in api/src/Rdex/Entity/RdexPassenger.php and 1 other location - About 1 day to fix
      api/src/Rdex/Entity/RdexDriver.php on lines 1..176

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 265.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      <?php
      
      /**
       * Copyright (c) 2018, MOBICOOP. All rights reserved.
       * This project is dual licensed under AGPL and proprietary licence.
      Severity: Major
      Found in api/src/Rdex/Entity/RdexDriver.php and 1 other location - About 1 day to fix
      api/src/Rdex/Entity/RdexPassenger.php on lines 1..176

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 265.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      <?php
      
      /**
       * Copyright (c) 2020, MOBICOOP. All rights reserved.
       * This project is dual licensed under AGPL and proprietary licence.
      Severity: Major
      Found in api/src/Payment/Command/CarpoolItemBatchCommand.php and 1 other location - About 1 day to fix
      api/src/Payment/Command/PaymentExportBatchCommand.php on lines 1..79

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 264.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      <?php
      
      /**
       * Copyright (c) 2020, MOBICOOP. All rights reserved.
       * This project is dual licensed under AGPL and proprietary licence.
      Severity: Major
      Found in api/src/Payment/Command/PaymentExportBatchCommand.php and 1 other location - About 1 day to fix
      api/src/Payment/Command/CarpoolItemBatchCommand.php on lines 1..78

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 264.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Mass has 61 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Mass implements ResourceInterface
      {
          const TYPE_ANONYMOUS = 0;
          const TYPE_QUALIFIED = 1;
      
      
      Severity: Major
      Found in client/src/MobicoopBundle/Match/Entity/Mass.php - About 1 day to fix

        LongDistanceSubscription has 61 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class LongDistanceSubscription extends Subscription
        {
            public const INITIAL_COMMITMENT_PROOF_PATH = '/api/public/upload/eec-incentives/initial-commitment-proof';
            public const HONOUR_CERTIFICATE_PATH = '/api/public/upload/eec-incentives/long-distance-subscription/honour-certificate/';
        
        
        Severity: Major
        Found in api/src/Incentive/Entity/LongDistanceSubscription.php - About 1 day to fix

          MassPerson has 61 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class MassPerson
          {
              /**
               * @var int the id of this person
               *
          Severity: Major
          Found in api/src/Match/Entity/MassPerson.php - About 1 day to fix

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                private function getMatchingRegularDayAsOffer(Matching $matching, ResultItem $item): ?array
                {
                    $proposal = $matching->getProposalOffer();
                    $result = $this->getFirstCarpooledRegularDay($proposal, $matching->getProposalRequest(), 'offer');
                    $item->setDate($result['date']);
            Severity: Major
            Found in api/src/Carpool/Service/ResultManager.php and 1 other location - About 1 day to fix
            api/src/Carpool/Service/ResultManager.php on lines 2325..2375

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 260.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                private function getMatchingRegularDayAsRequest(Matching $matching, ResultItem $item): ?array
                {
                    $proposal = $matching->getProposalRequest();
                    $result = $this->getFirstCarpooledRegularDay($proposal, $matching->getProposalOffer(), 'request');
                    $item->setDate($result['date']);
            Severity: Major
            Found in api/src/Carpool/Service/ResultManager.php and 1 other location - About 1 day to fix
            api/src/Carpool/Service/ResultManager.php on lines 2383..2433

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 260.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Address has 60 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Address implements ResourceInterface, \JsonSerializable
            {
                /**
                 * @var int the id of this address
                 * @Groups({"post","put"})
            Severity: Major
            Found in client/src/MobicoopBundle/Geography/Entity/Address.php - About 1 day to fix

              CarpoolProof has 60 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class CarpoolProof
              {
                  public const STATUS_INITIATED = 0;              // not ready to be sent, proof still under construction
                  public const STATUS_PENDING = 1;                // ready to be sent
                  public const STATUS_SENT = 2;                   // sent
              Severity: Major
              Found in api/src/Carpool/Entity/CarpoolProof.php - About 1 day to fix

                CarpoolItem has 60 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class CarpoolItem
                {
                    public const STATUS_INITIALIZED = 0;               // carpool supposed to be done
                    public const STATUS_REALIZED = 1;                  // carpool confirmed
                    public const STATUS_NOT_REALIZED = 2;              // carpool invalidated (no carpool for this day)
                Severity: Major
                Found in api/src/Payment/Entity/CarpoolItem.php - About 1 day to fix

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      public function getSolidaryBeneficiaries(array $filters = null, bool $validatedCandidate = null, $returnAllBeneficiaries = false): array
                      {
                          $beneficiaries = [];
                  
                          $structureAdmin = null;
                  Severity: Major
                  Found in api/src/Solidary/Service/SolidaryUserManager.php and 1 other location - About 1 day to fix
                  api/src/Solidary/Service/SolidaryUserManager.php on lines 453..488

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 256.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      public function getSolidaryVolunteers(array $filters = null, bool $validatedCandidate = null, $returnAllVolonteers = false): array
                      {
                          $volunteers = [];
                  
                          $structureAdmin = null;
                  Severity: Major
                  Found in api/src/Solidary/Service/SolidaryUserManager.php and 1 other location - About 1 day to fix
                  api/src/Solidary/Service/SolidaryUserManager.php on lines 409..444

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 256.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Community has 59 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Community implements ResourceInterface, \JsonSerializable
                  {
                      public const AUTO_VALIDATION = 0;
                      public const MANUAL_VALIDATION = 1;
                      public const DOMAIN_VALIDATION = 2;
                  Severity: Major
                  Found in client/src/MobicoopBundle/Community/Entity/Community.php - About 1 day to fix
                    Severity
                    Category
                    Status
                    Source
                    Language