HumanCellAtlas/ingest-core

View on GitHub

Showing 78 of 78 total issues

SubmissionController has 27 methods (exceeds 20 allowed). Consider refactoring.
Open

@RepositoryRestController
@ExposesResourceFor(SubmissionEnvelope.class)
@RequiredArgsConstructor
@Getter
public class SubmissionController {

    QueueConfig has 27 methods (exceeds 20 allowed). Consider refactoring.
    Open

    @Configuration
    public class QueueConfig implements RabbitListenerConfigurer {
        @Bean Queue queueFileUpdate() { return new Queue(Constants.Queues.FILE_UPDATE, false); }
    
        @Bean Queue queueBundleUpdate() { return new Queue(Constants.Routing.UPDATE_SUBMITTED, true); }
    Severity: Minor
    Found in src/main/java/org/humancellatlas/ingest/messaging/QueueConfig.java - About 3 hrs to fix

      Method cleanupLinksToSubmissionMetadata has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private void cleanupLinksToSubmissionMetadata(SubmissionEnvelope submissionEnvelope) {
              long startTime = System.currentTimeMillis();
      
              processRepository.findBySubmissionEnvelope(submissionEnvelope)
                               .forEach(p -> {

        Method findByCriteria has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @Override
            public Page<Project> findByCriteria(List<MetadataCriteria> criteriaList, Boolean andCriteria, Pageable pageable) {
                Query query = new Query();
                
                List<Criteria> criterias = new ArrayList<>();

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

              private Optional<String> getRelNameForCommitSubmissionState(SubmissionState submissionState) {
                  switch (submissionState) {
                      case DRAFT:
                          return Optional.of(Links.COMMIT_DRAFT_REL);
                      case VALIDATING:
          src/main/java/org/humancellatlas/ingest/submission/web/SubmissionEnvelopeResourceProcessor.java on lines 201..223

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

          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 Optional<String> getSubresourceNameForCommitSubmissionState(SubmissionState submissionState) {
                  switch (submissionState) {
                      case DRAFT:
                          return Optional.of(Links.COMMIT_DRAFT_URL);
                      case VALIDATING:
          src/main/java/org/humancellatlas/ingest/submission/web/SubmissionEnvelopeResourceProcessor.java on lines 177..199

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

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

          package org.humancellatlas.ingest.core.service.strategy.impl;
          
          import lombok.AllArgsConstructor;
          import lombok.NonNull;
          import org.humancellatlas.ingest.biomaterial.Biomaterial;
          src/main/java/org/humancellatlas/ingest/core/service/strategy/impl/FileCrudStrategy.java on lines 1..51
          src/main/java/org/humancellatlas/ingest/core/service/strategy/impl/ProcessCrudStrategy.java on lines 1..51
          src/main/java/org/humancellatlas/ingest/core/service/strategy/impl/ProjectCrudStrategy.java on lines 1..52
          src/main/java/org/humancellatlas/ingest/core/service/strategy/impl/ProtocolCrudStrategy.java on lines 1..51

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

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

          package org.humancellatlas.ingest.core.service.strategy.impl;
          
          import lombok.AllArgsConstructor;
          import lombok.NonNull;
          import org.humancellatlas.ingest.core.service.strategy.MetadataCrudStrategy;
          src/main/java/org/humancellatlas/ingest/core/service/strategy/impl/BiomaterialCrudStrategy.java on lines 1..52
          src/main/java/org/humancellatlas/ingest/core/service/strategy/impl/ProcessCrudStrategy.java on lines 1..51
          src/main/java/org/humancellatlas/ingest/core/service/strategy/impl/ProjectCrudStrategy.java on lines 1..52
          src/main/java/org/humancellatlas/ingest/core/service/strategy/impl/ProtocolCrudStrategy.java on lines 1..51

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

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

          package org.humancellatlas.ingest.core.service.strategy.impl;
          
          import lombok.AllArgsConstructor;
          import lombok.NonNull;
          import org.humancellatlas.ingest.core.service.strategy.MetadataCrudStrategy;
          src/main/java/org/humancellatlas/ingest/core/service/strategy/impl/BiomaterialCrudStrategy.java on lines 1..52
          src/main/java/org/humancellatlas/ingest/core/service/strategy/impl/FileCrudStrategy.java on lines 1..51
          src/main/java/org/humancellatlas/ingest/core/service/strategy/impl/ProjectCrudStrategy.java on lines 1..52
          src/main/java/org/humancellatlas/ingest/core/service/strategy/impl/ProtocolCrudStrategy.java on lines 1..51

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

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

          package org.humancellatlas.ingest.core.service.strategy.impl;
          
          import lombok.AllArgsConstructor;
          import lombok.NonNull;
          import org.humancellatlas.ingest.core.service.strategy.MetadataCrudStrategy;
          src/main/java/org/humancellatlas/ingest/core/service/strategy/impl/BiomaterialCrudStrategy.java on lines 1..52
          src/main/java/org/humancellatlas/ingest/core/service/strategy/impl/FileCrudStrategy.java on lines 1..51
          src/main/java/org/humancellatlas/ingest/core/service/strategy/impl/ProcessCrudStrategy.java on lines 1..51
          src/main/java/org/humancellatlas/ingest/core/service/strategy/impl/ProjectCrudStrategy.java on lines 1..52

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

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

          package org.humancellatlas.ingest.core.service.strategy.impl;
          
          import lombok.AllArgsConstructor;
          import lombok.NonNull;
          import org.humancellatlas.ingest.core.service.strategy.MetadataCrudStrategy;
          src/main/java/org/humancellatlas/ingest/core/service/strategy/impl/BiomaterialCrudStrategy.java on lines 1..52
          src/main/java/org/humancellatlas/ingest/core/service/strategy/impl/FileCrudStrategy.java on lines 1..51
          src/main/java/org/humancellatlas/ingest/core/service/strategy/impl/ProcessCrudStrategy.java on lines 1..51
          src/main/java/org/humancellatlas/ingest/core/service/strategy/impl/ProtocolCrudStrategy.java on lines 1..51

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

          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

          package org.humancellatlas.ingest.biomaterial;
          
          import lombok.Getter;
          import lombok.NonNull;
          import lombok.RequiredArgsConstructor;
          src/main/java/org/humancellatlas/ingest/protocol/ProtocolService.java 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 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

          package org.humancellatlas.ingest.protocol;
          
          import lombok.Getter;
          import lombok.NonNull;
          import lombok.RequiredArgsConstructor;
          src/main/java/org/humancellatlas/ingest/biomaterial/BiomaterialService.java on lines 1..39

          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

              private Optional<String> getSubresourceNameForValidationState(ValidationState validationState) {
                  switch (validationState) {
                      case DRAFT:
                          return Optional.of(Links.DRAFT_URL);
                      case VALIDATING:
          src/main/java/org/humancellatlas/ingest/core/web/MetadataDocumentResourceProcessor.java on lines 48..66

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

          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 Optional<String> getRelNameForValidationState(ValidationState validationState) {
                  switch (validationState) {
                      case DRAFT:
                          return Optional.of(Links.DRAFT_REL);
                      case VALIDATING:
          src/main/java/org/humancellatlas/ingest/core/web/MetadataDocumentResourceProcessor.java on lines 68..86

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

          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 allowedStateTransitions has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static List<SubmissionState> allowedStateTransitions(SubmissionState fromState) {
                  List<SubmissionState> allowedStates = new ArrayList<>();
                  switch (fromState) {
                      case PENDING:
                          allowedStates.add(SubmissionState.DRAFT);

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

                    if (transitionResourceName.isPresent()) {
                        Optional<String> rel = getRelNameForCommitSubmissionState(targetState);
                        if (rel.isPresent()) {
                            return Optional.of(entityLinks.linkForSingleResource(submissionEnvelope)
                                                          .slash(transitionResourceName.get())
            src/main/java/org/humancellatlas/ingest/submission/web/SubmissionEnvelopeResourceProcessor.java on lines 101..113

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

            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 (transitionResourceName.isPresent()) {
                        Optional<String> rel = getRelNameForRequestSubmissionState(targetState);
                        if (rel.isPresent()) {
                            return Optional.of(entityLinks.linkForSingleResource(submissionEnvelope)
                                    .slash(transitionResourceName.get())
            src/main/java/org/humancellatlas/ingest/submission/web/SubmissionEnvelopeResourceProcessor.java on lines 118..130

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

            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

            package org.humancellatlas.ingest.core;
            
            import lombok.Data;
            
            import java.util.Date;
            src/main/java/org/humancellatlas/ingest/core/SubmissionDate.java on lines 1..31

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

            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

            package org.humancellatlas.ingest.core;
            
            import lombok.Data;
            
            import java.util.Date;
            src/main/java/org/humancellatlas/ingest/core/UpdateDate.java on lines 1..31

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

            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