nplhse/cois-hub

View on GitHub

Showing 17 of 17 total issues

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

#[ORM\Entity(repositoryClass: UserRepository::class)]
#[UniqueEntity(fields: ['username'], message: 'There is already an account with this username')]
class User implements UserInterface, PasswordAuthenticatedUserInterface, \Stringable
{
    #[ORM\Id]
Severity: Minor
Found in src/Entity/User.php - About 3 hrs to fix

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

    <?php
    
    namespace App\Repository;
    
    use App\Entity\Hospital;
    Severity: Major
    Found in src/Repository/HospitalRepository.php and 3 other locations - About 3 hrs to fix
    src/Repository/DispatchAreaRepository.php on lines 1..44
    src/Repository/StateRepository.php on lines 1..44
    src/Repository/SupplyAreaRepository.php on lines 1..44

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

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

    <?php
    
    namespace App\Repository;
    
    use App\Entity\State;
    Severity: Major
    Found in src/Repository/StateRepository.php and 3 other locations - About 3 hrs to fix
    src/Repository/DispatchAreaRepository.php on lines 1..44
    src/Repository/HospitalRepository.php on lines 1..44
    src/Repository/SupplyAreaRepository.php on lines 1..44

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

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

    <?php
    
    namespace App\Repository;
    
    use App\Entity\DispatchArea;
    Severity: Major
    Found in src/Repository/DispatchAreaRepository.php and 3 other locations - About 3 hrs to fix
    src/Repository/HospitalRepository.php on lines 1..44
    src/Repository/StateRepository.php on lines 1..44
    src/Repository/SupplyAreaRepository.php on lines 1..44

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

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

    <?php
    
    namespace App\Repository;
    
    use App\Entity\SupplyArea;
    Severity: Major
    Found in src/Repository/SupplyAreaRepository.php and 3 other locations - About 3 hrs to fix
    src/Repository/DispatchAreaRepository.php on lines 1..44
    src/Repository/HospitalRepository.php on lines 1..44
    src/Repository/StateRepository.php on lines 1..44

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

    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

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

        public function buildForm(FormBuilderInterface $builder, array $options): void
        {
            $builder
                ->add('username', TextType::class)
                ->add('email', EmailType::class)
    Severity: Minor
    Found in src/Form/Security/RegistrationType.php - About 1 hr to fix

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

          public function buildForm(FormBuilderInterface $builder, array $options): void
          {
              $builder
                  ->add('username', TextType::class)
                  ->add('password', PasswordType::class, [
      Severity: Minor
      Found in src/Form/User/CreateUserType.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('id', HiddenType::class)
                    ->add('username', TextType::class)
        Severity: Minor
        Found in src/Form/User/EditUserType.php - About 1 hr to fix

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

          <?php
          
          declare(strict_types=1);
          
          namespace App\Enum;
          Severity: Major
          Found in src/Enum/HospitalSize.php and 1 other location - About 1 hr to fix
          src/Enum/HospitalTier.php on lines 1..33

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

          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
          
          declare(strict_types=1);
          
          namespace App\Enum;
          Severity: Major
          Found in src/Enum/HospitalTier.php and 1 other location - About 1 hr to fix
          src/Enum/HospitalSize.php on lines 1..33

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

          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

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

              public function buildForm(FormBuilderInterface $builder, array $options): void
              {
                  $builder
                      ->add('currentPassword', PasswordType::class, [
                          'mapped' => false,
          Severity: Minor
          Found in src/Form/User/UpdateUserPasswordType.php - About 1 hr to fix

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

                public function buildForm(FormBuilderInterface $builder, array $options): void
                {
                    $builder
                        ->add('plainPassword', RepeatedType::class, [
                            'type' => PasswordType::class,
            Severity: Minor
            Found in src/Form/Security/ChangePasswordFormType.php - About 1 hr to fix

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

                  public function getConfigTreeBuilder(): TreeBuilder
                  {
                      $treeBuilder = new TreeBuilder('app');
              
                      $treeBuilder->getRootNode()
              Severity: Minor
              Found in src/DependencyInjection/AppConfiguration.php - About 1 hr to fix

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

                    public function up(Schema $schema): void
                    {
                        // this up() migration is auto-generated, please modify it to your needs
                        $this->addSql('CREATE TABLE hospital (id INT AUTO_INCREMENT NOT NULL, owner_id INT NOT NULL, state_id INT NOT NULL, dispatch_area_id INT NOT NULL, supply_area_id INT DEFAULT NULL, created_by_id INT NOT NULL, updated_by_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, size VARCHAR(255) NOT NULL, beds INT NOT NULL, location VARCHAR(255) NOT NULL, tier VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', address_street VARCHAR(255) NOT NULL, address_postal_code VARCHAR(255) NOT NULL, address_city VARCHAR(255) NOT NULL, address_state VARCHAR(255) NOT NULL, address_country VARCHAR(255) NOT NULL, INDEX IDX_4282C85B7E3C61F9 (owner_id), INDEX IDX_4282C85B5D83CC1 (state_id), INDEX IDX_4282C85B957FD192 (dispatch_area_id), INDEX IDX_4282C85B1B81C31 (supply_area_id), INDEX IDX_4282C85BB03A8386 (created_by_id), INDEX IDX_4282C85B896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
                        $this->addSql('CREATE TABLE hospital_user (hospital_id INT NOT NULL, user_id INT NOT NULL, INDEX IDX_C727C0863DBB69 (hospital_id), INDEX IDX_C727C08A76ED395 (user_id), PRIMARY KEY(hospital_id, user_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
                Severity: Major
                Found in migrations/Version20240115185259.php and 1 other location - About 1 hr to fix
                migrations/Version20240115185259.php on lines 35..48

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

                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 down(Schema $schema): void
                    {
                        // this down() migration is auto-generated, please modify it to your needs
                        $this->addSql('ALTER TABLE hospital DROP FOREIGN KEY FK_4282C85B7E3C61F9');
                        $this->addSql('ALTER TABLE hospital DROP FOREIGN KEY FK_4282C85B5D83CC1');
                Severity: Major
                Found in migrations/Version20240115185259.php and 1 other location - About 1 hr to fix
                migrations/Version20240115185259.php on lines 20..33

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

                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

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

                        #[ORM\Column(length: 255)]
                        private string $entityType,
                        #[ORM\Column]
                        private int $entityId,
                        #[ORM\Column]
                Severity: Major
                Found in src/Entity/AuditLog.php - About 1 hr to fix

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

                      private function normalizeEntityData(array $entityData): array
                      {
                          foreach ($entityData as $key => $value) {
                              if (is_object($value[0])) {
                                  $entityData[$key][0] = $this->normalizeEntityId($value[0]);
                  Severity: Minor
                  Found in src/EventSubscriber/AuditUpdateSubscriber.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