CMSgov/dpc-app

View on GitHub

Showing 315 of 390 total issues

Identical blocks of code found in 3 locations. Consider refactoring.
Open

  config.lograge.custom_options = lambda do |event|
    { ddsource: 'ruby',
      params: event.payload[:params].reject { |k| %w(controller action).include? k },
      environment: ENV['ENV'] || :development,
      exception: event.payload[:exception],
Severity: Major
Found in dpc-portal/config/initializers/lograge.rb and 2 other locations - About 45 mins to fix
dpc-admin/config/initializers/lograge.rb on lines 4..10
dpc-web/config/initializers/lograge.rb on lines 2..8

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

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

    @Inject
    public DataService(IJobQueue queue, FhirContext fhirContext, @ExportPath String exportPath, @JobTimeout int jobTimeoutInSeconds) {
        this.queue = queue;
        this.fhirContext = fhirContext;
        this.exportPath = exportPath;
dpc-aggregation/src/main/java/gov/cms/dpc/aggregation/engine/AggregationEngine.java on lines 58..64
dpc-api/src/main/java/gov/cms/dpc/api/auth/DPCAuthFactory.java on lines 21..27
dpc-api/src/main/java/gov/cms/dpc/api/resources/v1/PatientResource.java on lines 61..67
dpc-attribution/src/main/java/gov/cms/dpc/attribution/resources/v1/OrganizationResource.java on lines 49..55

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

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

    public ProviderEntity updateProvider(UUID providerID, ProviderEntity providerEntity) {
        final ProviderEntity existingProvider = this.getProvider(providerID)
                .orElseThrow(() -> new IllegalArgumentException("Cannot find provider"));

        final ProviderEntity fullyUpdated = existingProvider.update(providerEntity);
dpc-attribution/src/main/java/gov/cms/dpc/attribution/jdbi/PatientDAO.java on lines 70..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 51.

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

    public PatientEntity updatePatient(UUID patientID, PatientEntity updatedPatient) {
        final PatientEntity patient = this.getPatient(patientID)
                .orElseThrow(() -> new IllegalArgumentException("Cannot find patient"));

        final PatientEntity fullyUpdated = patient.update(updatedPatient);
dpc-attribution/src/main/java/gov/cms/dpc/attribution/jdbi/ProviderDAO.java on lines 67..75

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

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

Consider simplifying this complex logical expression.
Open

  if (typeof ElementProto.matches !== 'function') {
    ElementProto.matches = ElementProto.msMatchesSelector || ElementProto.mozMatchesSelector || ElementProto.webkitMatchesSelector || function matches(selector) {
      var element = this;
      var elements = (element.document || element.ownerDocument).querySelectorAll(selector);
      var index = 0;
Severity: Major
Found in dpc-admin/app/assets/javascripts/components/_accordions.js - About 40 mins to fix

    Function getAssumeRoleArn has 6 return statements (exceeds 4 allowed).
    Open

    func getAssumeRoleArn() (string, error) {
        if isTesting {
            val := os.Getenv("AWS_ASSUME_ROLE_ARN")
            if val == "" {
                return "", fmt.Errorf("AWS_ASSUME_ROLE_ARN must be set during testing")
    Severity: Major
    Found in lambda/opt-out-import/db.go - About 40 mins to fix

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

          public LookBackAnswer(String practitionerNPI, String organizationNPI, long withinMonths, YearMonth lookBackMonth) {
              this.practitionerNPI = practitionerNPI;
              this.organizationNPI = organizationNPI;
              this.withinMonths = withinMonths;
              this.lookBackMonth = lookBackMonth;
      dpc-aggregation/src/main/java/gov/cms/dpc/aggregation/engine/ResourceWriter.java on lines 51..59
      dpc-api/src/main/java/gov/cms/dpc/api/auth/DPCAuthCredentials.java on lines 16..21
      dpc-api/src/main/java/gov/cms/dpc/api/auth/DPCAuthFilter.java on lines 45..50
      dpc-common/src/main/java/gov/cms/dpc/common/models/JobCompletionModel.java on lines 51..56

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

      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

          protected DPCAuthFilter(MacaroonBakery bakery, Authenticator<DPCAuthCredentials, OrganizationPrincipal> auth, TokenDAO dao, DPCUnauthorizedHandler dpc401handler ) {
              this.authenticator = auth;
              this.bakery = bakery;
              this.dao = dao;
              this.dpc401handler = dpc401handler;
      Severity: Major
      Found in dpc-api/src/main/java/gov/cms/dpc/api/auth/DPCAuthFilter.java and 4 other locations - About 40 mins to fix
      dpc-aggregation/src/main/java/gov/cms/dpc/aggregation/engine/ResourceWriter.java on lines 51..59
      dpc-aggregation/src/main/java/gov/cms/dpc/aggregation/service/LookBackAnswer.java on lines 22..27
      dpc-api/src/main/java/gov/cms/dpc/api/auth/DPCAuthCredentials.java on lines 16..21
      dpc-common/src/main/java/gov/cms/dpc/common/models/JobCompletionModel.java on lines 51..56

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

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

      package gov.cms.dpc.common.annotations;
      
      import gov.cms.dpc.common.hibernate.validator.NPIValidator;
      
      import javax.validation.Constraint;
      dpc-common/src/main/java/gov/cms/dpc/common/annotations/NoHtml.java on lines 1..26
      dpc-common/src/main/java/gov/cms/dpc/common/annotations/OrganizationId.java on lines 1..25

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

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

      package gov.cms.dpc.common.annotations;
      
      import gov.cms.dpc.common.hibernate.validator.OrganizationIdValidator;
      
      import javax.validation.Constraint;
      dpc-common/src/main/java/gov/cms/dpc/common/annotations/NPI.java on lines 1..25
      dpc-common/src/main/java/gov/cms/dpc/common/annotations/NoHtml.java on lines 1..26

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

      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

          public DPCAuthCredentials(String macaroon, Organization organization, PathAuthorizer pa, String pathValue) {
              this.macaroon = macaroon;
              this.organization = organization;
              this.pa = pa;
              this.pathValue = pathValue;
      dpc-aggregation/src/main/java/gov/cms/dpc/aggregation/engine/ResourceWriter.java on lines 51..59
      dpc-aggregation/src/main/java/gov/cms/dpc/aggregation/service/LookBackAnswer.java on lines 22..27
      dpc-api/src/main/java/gov/cms/dpc/api/auth/DPCAuthFilter.java on lines 45..50
      dpc-common/src/main/java/gov/cms/dpc/common/models/JobCompletionModel.java on lines 51..56

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

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

      package gov.cms.dpc.common.annotations;
      
      import gov.cms.dpc.common.hibernate.validator.NoHtmlValidator;
      
      import javax.validation.Constraint;
      dpc-common/src/main/java/gov/cms/dpc/common/annotations/NPI.java on lines 1..25
      dpc-common/src/main/java/gov/cms/dpc/common/annotations/OrganizationId.java on lines 1..25

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

      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

      Function UploadFileToS3 has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      func UploadFileToS3(s *session.Session, fileName string, buff bytes.Buffer, s3Bucket string, s3Path string) error {
      Severity: Minor
      Found in lambda/opt-out-export/dpcaws/s3.go - About 35 mins to fix

        Method generate_credentials has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def generate_credentials(credentials, org_bundle, public_key_label, path_to_org_pub_key, expiration)
        Severity: Minor
        Found in scripts/generate_credentials.rb - About 35 mins to fix

          Method createRosterSubmission has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              private static void createRosterSubmission(IGenericClient client, InputStream resource, Bundle providerBundle, UUID organizationID, Map<String, Reference> patientReferences) throws IOException {

            Method retrieveData has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public Resource retrieveData(UUID organizationId, String orgNPI, String providerNPI, List<String> patientIds, DPCResourceType... resourceTypes) {
            Severity: Minor
            Found in dpc-queue/src/main/java/gov/cms/dpc/queue/service/DataService.java - About 35 mins to fix

              Method encodeSecretPart has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Confirmed

                  static byte[] encodeSecretPart(byte[] thirdPartyKey, byte[] privateKey, byte[] nonce, String rootKey, String caveat) {
              Severity: Minor
              Found in dpc-macaroons/src/main/java/gov/cms/dpc/macaroons/MacaroonBakery.java - About 35 mins to fix

                Method registerOrganization has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public static String registerOrganization(IGenericClient client, IParser parser, String organizationID, String organizationNPI, String adminURL) throws IOException {
                Severity: Minor
                Found in dpc-common/src/main/java/gov/cms/dpc/fhir/helpers/FHIRHelpers.java - About 35 mins to fix

                  Method fetchBundle has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      private <T extends IBaseResource> Bundle fetchBundle(Class<T> resourceClass,
                                                                           List<ICriterion<? extends IParam>> criteria,
                                                                           String patientID,
                                                                           DateRangeParam lastUpdated,
                                                                           Map<String, String> headers) {

                    Method exportDataAndHandleResults has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        private void exportDataAndHandleResults(IGenericClient exportClient, Bundle providerBundle, String clientToken, Pair<UUID,PrivateKey> keyTuple, SampleResult parentSampler){
                      Severity
                      Category
                      Status
                      Source
                      Language