CMSgov/dpc-app

View on GitHub

Showing 319 of 394 total issues

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

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
Severity: Major
Found in dpc-admin/app/assets/javascripts/components/_accordions.js and 1 other location - About 3 hrs to fix
dpc-admin/app/assets/javascripts/components/_accordions.js on lines 223..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 97.

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

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
Severity: Major
Found in dpc-admin/app/assets/javascripts/components/_accordions.js and 1 other location - About 3 hrs to fix
dpc-admin/app/assets/javascripts/components/_accordions.js on lines 767..767

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

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

File SmokeTest.java has 288 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package gov.cms.dpc.testing.smoketests;

import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.rest.client.api.IGenericClient;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;

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

    if(typeof(close_mobile_nav_button) != 'undefined' && close_mobile_nav_button != null){
      close_mobile_nav_button.addEventListener("click", function(e) {
        document.body.classList.remove(nav_open_class);
        mobile_nav.classList.remove(visible_class);
        open_mobile_nav_button.focus();
    Severity: Major
    Found in dpc-admin/app/assets/javascripts/components/navbar.js and 1 other location - About 2 hrs to fix
    dpc-web/app/assets/javascripts/components/navbar.js on lines 19..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 90.

    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

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

    if(typeof(close_mobile_nav_button) != 'undefined' && close_mobile_nav_button != null){
      close_mobile_nav_button.addEventListener("click", function(e) {
        document.body.classList.remove(nav_open_class);
        mobile_nav.classList.remove(visible_class);
        open_mobile_nav_button.focus();
    Severity: Major
    Found in dpc-web/app/assets/javascripts/components/navbar.js and 1 other location - About 2 hrs to fix
    dpc-admin/app/assets/javascripts/components/navbar.js on lines 19..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 90.

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

    module.exports = function(api) {
      var validEnv = ['development', 'test', 'production']
      var currentEnv = api.env()
      var isDevelopmentEnv = api.env('development')
      var isProductionEnv = api.env('production')
    Severity: Major
    Found in dpc-admin/babel.config.js - About 2 hrs to fix

      Function 3 has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

      },{}],3:[function(require,module,exports){
      'use strict';
      
      // element-closest | CC0-1.0 | github.com/jonathantneal/closest
      
      
      Severity: Minor
      Found in dpc-admin/app/assets/javascripts/components/_accordions.js - About 2 hrs 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

      File DistributedBatchQueue.java has 274 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      package gov.cms.dpc.queue;
      
      import com.codahale.metrics.MetricRegistry;
      import com.codahale.metrics.Timer;
      import gov.cms.dpc.common.hibernate.queue.DPCQueueManagedSessionFactory;
      Severity: Minor
      Found in dpc-queue/src/main/java/gov/cms/dpc/queue/DistributedBatchQueue.java - About 2 hrs to fix

        Function 4 has 63 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        },{}],4:[function(require,module,exports){
        /*
        object-assign
        (c) Sindre Sorhus
        @license MIT
        Severity: Major
        Found in dpc-admin/app/assets/javascripts/components/_accordions.js - About 2 hrs to fix

          Function 9 has 62 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          },{"../compose":6,"../delegate":7}],9:[function(require,module,exports){
          'use strict';
          
          function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
          
          
          Severity: Major
          Found in dpc-admin/app/assets/javascripts/components/_accordions.js - About 2 hrs to fix

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

            var close_mobile_nav_button = document.getElementById("topnav__close-button"),
                open_mobile_nav_button = document.getElementById("topnav__show-button"),
                mobile_nav = document.getElementById("topnav-wrap"),
                navbar = document.getElementById("navbar"),
                overlay = document.createElement("div"),
            Severity: Major
            Found in dpc-admin/app/assets/javascripts/components/navbar.js and 1 other location - About 2 hrs to fix
            dpc-web/app/assets/javascripts/components/navbar.js on lines 1..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 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

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

            var close_mobile_nav_button = document.getElementById("topnav__close-button"),
                open_mobile_nav_button = document.getElementById("topnav__show-button"),
                mobile_nav = document.getElementById("topnav-wrap"),
                navbar = document.getElementById("navbar"),
                overlay = document.createElement("div"),
            Severity: Major
            Found in dpc-web/app/assets/javascripts/components/navbar.js and 1 other location - About 2 hrs to fix
            dpc-admin/app/assets/javascripts/components/navbar.js on lines 1..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 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

            Function 5 has 57 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            },{}],5:[function(require,module,exports){
            'use strict';
            
            var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
            
            
            Severity: Major
            Found in dpc-admin/app/assets/javascripts/components/_accordions.js - About 2 hrs to fix

              Function importResponseFile has 78 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func importResponseFile(bucket string, file string) (int, int, string, error) {
                  log.Infof("Importing opt out file: %s (bucket: %s)", file, bucket)
                  metadata, err := ParseMetadata(bucket, file)
                  if err != nil {
                      log.Warningf("Failed to parse opt out file metadata: %s", err)
              Severity: Major
              Found in lambda/opt-out-import/main.go - About 2 hrs to fix

                File JobBatchProcessor.java has 252 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                package gov.cms.dpc.aggregation.engine;
                
                import ca.uhn.fhir.context.FhirContext;
                import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
                import com.codahale.metrics.Meter;

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

                    def self.to_csv(user_ids)
                      users = User.find(user_ids)
                      CSV.generate(headers: true) do |csv|
                        csv << ATTRS
                        users.each do |user|
                  Severity: Major
                  Found in dpc-web/app/models/user.rb and 1 other location - About 1 hr to fix
                  dpc-admin/app/models/user.rb on lines 73..93

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

                  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

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

                    def self.to_csv(user_ids)
                      users = User.find(user_ids)
                      CSV.generate(headers: true) do |csv|
                        csv << ATTRS
                        users.each do |user|
                  Severity: Major
                  Found in dpc-admin/app/models/user.rb and 1 other location - About 1 hr to fix
                  dpc-web/app/models/user.rb on lines 92..112

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

                  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 gov.cms.dpc.api.tasks.keys;
                  
                  import gov.cms.dpc.api.auth.OrganizationPrincipal;
                  import gov.cms.dpc.api.resources.v1.KeyResource;
                  import io.dropwizard.servlets.tasks.Task;
                  dpc-api/src/main/java/gov/cms/dpc/api/tasks/tokens/DeleteToken.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 120.

                  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 gov.cms.dpc.api.tasks.tokens;
                  
                  import gov.cms.dpc.api.auth.OrganizationPrincipal;
                  import gov.cms.dpc.api.resources.v1.TokenResource;
                  import io.dropwizard.servlets.tasks.Task;
                  dpc-api/src/main/java/gov/cms/dpc/api/tasks/keys/DeletePublicKey.java on lines 1..50

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

                  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 (!("classList" in document.createElement("_")) || document.createElementNS && !("classList" in document.createElementNS("http://www.w3.org/2000/svg", "g"))) {
                  
                      (function (view) {
                  
                        "use strict";
                  Severity: Critical
                  Found in dpc-admin/app/assets/javascripts/components/_accordions.js - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language