Covivo/mobicoop

View on GitHub

Showing 1,612 of 1,620 total issues

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

                if ($nblegs == (count($data['sections']) - 1)) {
                    if (isset($section['to'])) {
                        $arrival = new PTArrival(1); // we have to set an id as it's mandatory when using a custom data provider (see https://api-platform.com/docs/core/data-providers)
                        if ($data['arrival_date_time']) {
                            $arrival->setDate(new \DateTime($data['arrival_date_time']));
Severity: Major
Found in api/src/DataProvider/Entity/NavitiaProvider.php and 1 other location - About 2 hrs to fix
api/src/DataProvider/Entity/NavitiaProvider.php on lines 156..173

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 125.

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

                if (0 == $nblegs) {
                    if (isset($section['from'])) {
                        $departure = new PTDeparture(1); // we have to set an id as it's mandatory when using a custom data provider (see https://api-platform.com/docs/core/data-providers)
                        if ($data['departure_date_time']) {
                            $departure->setDate(new \DateTime($data['departure_date_time']));
Severity: Major
Found in api/src/DataProvider/Entity/NavitiaProvider.php and 1 other location - About 2 hrs to fix
api/src/DataProvider/Entity/NavitiaProvider.php on lines 176..193

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 125.

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

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

class Recipient
{
    const STATUS_PENDING = 1;
    const STATUS_READ = 2;

Severity: Minor
Found in api/src/Communication/Entity/Recipient.php - About 2 hrs to fix

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

    class SolidaryAsksListItem
    {
        const DRIVER_TYPE_VOLUNTEER = 0;
        const DRIVER_TYPE_CARPOOLER = 1;
    
    
    Severity: Minor
    Found in api/src/Solidary/Entity/SolidaryAsksListItem.php - About 2 hrs to fix

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

      class SolidaryResultCarpool
      {
          const DEFAULT_ID = 999999999999;
          
          /**
      Severity: Minor
      Found in api/src/Solidary/Entity/SolidaryResult/SolidaryResultCarpool.php - About 2 hrs to fix

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

        class ProofManager
        {
            private $entityManager;
            private $logger;
            private $provider;
        Severity: Minor
        Found in api/src/Carpool/Service/ProofManager.php - About 2 hrs to fix

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

          class SolidaryManager
          {
              /**
               * @var User
               */
          Severity: Minor
          Found in api/src/Solidary/Admin/Service/SolidaryManager.php - About 2 hrs to fix

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

            class ClassicProof
            {
                public const DEFAULT_ID = 999999999999;
            
                /**
            Severity: Minor
            Found in api/src/Carpool/Ressource/ClassicProof.php - About 2 hrs to fix

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

              class Delivery
              {
                  public const STATUS_PENDING = 0;
                  public const STATUS_SENT = 1;
                  public const STATUS_ERROR = 2;
              Severity: Minor
              Found in api/src/MassCommunication/Entity/Delivery.php - About 2 hrs to fix

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

                abstract class EecProvider implements EecProviderInterface
                {
                    /**
                     * @var null|string
                     */
                Severity: Minor
                Found in api/src/Incentive/Resource/Provider/EecProvider.php - About 2 hrs to fix

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

                  class Diary
                  {
                      /**
                       * @var int the id of this diary action
                       *
                  Severity: Minor
                  Found in api/src/Action/Entity/Diary.php - About 2 hrs to fix

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

                    class Territory implements ResourceInterface, \JsonSerializable
                    {
                        /**
                         * @var int
                         */
                    Severity: Minor
                    Found in client/src/MobicoopBundle/Territory/Entity/Territory.php - About 2 hrs to fix

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

                      class User
                      {
                          public const DEFAULT_ID = 999999999999;
                      
                          /**
                      Severity: Minor
                      Found in api/src/CarpoolStandard/Entity/User.php - About 2 hrs to fix

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

                        class CommunityManager
                        {
                            use HydraControllerTrait;
                        
                            private $dataProvider;
                        Severity: Minor
                        Found in client/src/MobicoopBundle/Community/Service/CommunityManager.php - About 2 hrs to fix

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

                          class CarpoolExport
                          {
                              public const DEFAULT_ID = 999999999999;
                          
                              public const ROLE_DRIVER = 1;
                          Severity: Minor
                          Found in api/src/Carpool/Entity/CarpoolExport.php - About 2 hrs to fix

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

                            class PTLine
                            {
                                /**
                                 * @var int The id of this line.
                                 *
                            Severity: Minor
                            Found in api/src/PublicTransport/Entity/PTLine.php - About 2 hrs to fix

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

                              class PublicProfile
                              {
                                  const SMOKE_NO = 0;
                                  const SMOKE_NOT_IN_CAR = 1;
                                  const SMOKE = 2;
                              Severity: Minor
                              Found in api/src/User/Ressource/PublicProfile.php - About 2 hrs to fix

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

                                <?php declare(strict_types=1);
                                
                                namespace DoctrineMigrations;
                                
                                use Doctrine\DBAL\Schema\Schema;
                                Severity: Major
                                Found in api/src/Migrations/Version20191118084315.php and 34 other locations - About 2 hrs to fix
                                api/src/Migrations/Version20190114094405.php on lines 1..51
                                api/src/Migrations/Version20190123081956.php on lines 1..51
                                api/src/Migrations/Version20190320124440.php on lines 1..51
                                api/src/Migrations/Version20190320150104.php on lines 1..51
                                api/src/Migrations/Version20190429152547.php on lines 1..51
                                api/src/Migrations/Version20190521083701.php on lines 1..30
                                api/src/Migrations/Version20190521084008.php on lines 1..30
                                api/src/Migrations/Version20190603141537.php on lines 1..30
                                api/src/Migrations/Version20191113131905.php on lines 1..30
                                api/src/Migrations/Version20191203091000.php on lines 1..30
                                api/src/Migrations/Version20200225163908.php on lines 1..30
                                api/src/Migrations/Version20200304145914.php on lines 1..30
                                api/src/Migrations/Version20200307092121.php on lines 1..30
                                api/src/Migrations/Version20200319125709.php on lines 1..30
                                api/src/Migrations/Version20200406085931.php on lines 1..30
                                api/src/Migrations/Version20200515093732.php on lines 1..30
                                api/src/Migrations/Version20200603091614.php on lines 1..30
                                api/src/Migrations/Version20200603092315.php on lines 1..30
                                api/src/Migrations/Version20200909163900.php on lines 1..30
                                api/src/Migrations/Version20201002122821.php on lines 1..30
                                api/src/Migrations/Version20210217153928.php on lines 1..30
                                api/src/Migrations/Version20210521151823.php on lines 1..30
                                api/src/Migrations/Version20211018084503.php on lines 1..30
                                api/src/Migrations/Version20211103095241.php on lines 1..30
                                api/src/Migrations/Version20221128065252.php on lines 1..30
                                api/src/Migrations/Version20230113075719.php on lines 1..30
                                api/src/Migrations/Version20230123075602.php on lines 1..30
                                api/src/Migrations/Version20230207133812.php on lines 1..30
                                api/src/Migrations/Version20230208140617.php on lines 1..30
                                api/src/Migrations/Version20230221071250.php on lines 1..30
                                api/src/Migrations/Version20230413090101.php on lines 1..30
                                api/src/Migrations/Version20230707091623.php on lines 1..30
                                api/src/Migrations/Version20231115160520.php on lines 1..30
                                api/src/Migrations/Version20231212195855.php on lines 1..30

                                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 124.

                                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 35 locations. Consider refactoring.
                                Open

                                <?php declare(strict_types=1);
                                
                                namespace DoctrineMigrations;
                                
                                use Doctrine\DBAL\Schema\Schema;
                                Severity: Major
                                Found in api/src/Migrations/Version20191203091000.php and 34 other locations - About 2 hrs to fix
                                api/src/Migrations/Version20190114094405.php on lines 1..51
                                api/src/Migrations/Version20190123081956.php on lines 1..51
                                api/src/Migrations/Version20190320124440.php on lines 1..51
                                api/src/Migrations/Version20190320150104.php on lines 1..51
                                api/src/Migrations/Version20190429152547.php on lines 1..51
                                api/src/Migrations/Version20190521083701.php on lines 1..30
                                api/src/Migrations/Version20190521084008.php on lines 1..30
                                api/src/Migrations/Version20190603141537.php on lines 1..30
                                api/src/Migrations/Version20191113131905.php on lines 1..30
                                api/src/Migrations/Version20191118084315.php on lines 1..30
                                api/src/Migrations/Version20200225163908.php on lines 1..30
                                api/src/Migrations/Version20200304145914.php on lines 1..30
                                api/src/Migrations/Version20200307092121.php on lines 1..30
                                api/src/Migrations/Version20200319125709.php on lines 1..30
                                api/src/Migrations/Version20200406085931.php on lines 1..30
                                api/src/Migrations/Version20200515093732.php on lines 1..30
                                api/src/Migrations/Version20200603091614.php on lines 1..30
                                api/src/Migrations/Version20200603092315.php on lines 1..30
                                api/src/Migrations/Version20200909163900.php on lines 1..30
                                api/src/Migrations/Version20201002122821.php on lines 1..30
                                api/src/Migrations/Version20210217153928.php on lines 1..30
                                api/src/Migrations/Version20210521151823.php on lines 1..30
                                api/src/Migrations/Version20211018084503.php on lines 1..30
                                api/src/Migrations/Version20211103095241.php on lines 1..30
                                api/src/Migrations/Version20221128065252.php on lines 1..30
                                api/src/Migrations/Version20230113075719.php on lines 1..30
                                api/src/Migrations/Version20230123075602.php on lines 1..30
                                api/src/Migrations/Version20230207133812.php on lines 1..30
                                api/src/Migrations/Version20230208140617.php on lines 1..30
                                api/src/Migrations/Version20230221071250.php on lines 1..30
                                api/src/Migrations/Version20230413090101.php on lines 1..30
                                api/src/Migrations/Version20230707091623.php on lines 1..30
                                api/src/Migrations/Version20231115160520.php on lines 1..30
                                api/src/Migrations/Version20231212195855.php on lines 1..30

                                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 124.

                                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 35 locations. Consider refactoring.
                                Open

                                <?php declare(strict_types=1);
                                
                                /**
                                 * Copyright (c) 2018, MOBICOOP. All rights reserved.
                                 * This project is dual licensed under AGPL and proprietary licence.
                                Severity: Major
                                Found in api/src/Migrations/Version20190114094405.php and 34 other locations - About 2 hrs to fix
                                api/src/Migrations/Version20190123081956.php on lines 1..51
                                api/src/Migrations/Version20190320124440.php on lines 1..51
                                api/src/Migrations/Version20190320150104.php on lines 1..51
                                api/src/Migrations/Version20190429152547.php on lines 1..51
                                api/src/Migrations/Version20190521083701.php on lines 1..30
                                api/src/Migrations/Version20190521084008.php on lines 1..30
                                api/src/Migrations/Version20190603141537.php on lines 1..30
                                api/src/Migrations/Version20191113131905.php on lines 1..30
                                api/src/Migrations/Version20191118084315.php on lines 1..30
                                api/src/Migrations/Version20191203091000.php on lines 1..30
                                api/src/Migrations/Version20200225163908.php on lines 1..30
                                api/src/Migrations/Version20200304145914.php on lines 1..30
                                api/src/Migrations/Version20200307092121.php on lines 1..30
                                api/src/Migrations/Version20200319125709.php on lines 1..30
                                api/src/Migrations/Version20200406085931.php on lines 1..30
                                api/src/Migrations/Version20200515093732.php on lines 1..30
                                api/src/Migrations/Version20200603091614.php on lines 1..30
                                api/src/Migrations/Version20200603092315.php on lines 1..30
                                api/src/Migrations/Version20200909163900.php on lines 1..30
                                api/src/Migrations/Version20201002122821.php on lines 1..30
                                api/src/Migrations/Version20210217153928.php on lines 1..30
                                api/src/Migrations/Version20210521151823.php on lines 1..30
                                api/src/Migrations/Version20211018084503.php on lines 1..30
                                api/src/Migrations/Version20211103095241.php on lines 1..30
                                api/src/Migrations/Version20221128065252.php on lines 1..30
                                api/src/Migrations/Version20230113075719.php on lines 1..30
                                api/src/Migrations/Version20230123075602.php on lines 1..30
                                api/src/Migrations/Version20230207133812.php on lines 1..30
                                api/src/Migrations/Version20230208140617.php on lines 1..30
                                api/src/Migrations/Version20230221071250.php on lines 1..30
                                api/src/Migrations/Version20230413090101.php on lines 1..30
                                api/src/Migrations/Version20230707091623.php on lines 1..30
                                api/src/Migrations/Version20231115160520.php on lines 1..30
                                api/src/Migrations/Version20231212195855.php on lines 1..30

                                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 124.

                                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

                                Severity
                                Category
                                Status
                                Source
                                Language