CMSgov/dpc-app

View on GitHub

Showing 186 of 222 total issues

Function 1 has a Cognitive Complexity of 109 (exceeds 11 allowed). Consider refactoring.
Open

(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
"use strict";

/*
 * classList.js: Cross-browser full element.classList implementation.
Severity: Minor
Found in dpc-admin/app/assets/javascripts/components/_accordions.js - About 2 days 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 _accordions.js has 572 lines of code (exceeds 250 allowed). Consider refactoring.
Open

(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
"use strict";

/*
 * classList.js: Cross-browser full element.classList implementation.
Severity: Major
Found in dpc-admin/app/assets/javascripts/components/_accordions.js - About 1 day to fix

    Function 1 has 166 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
    "use strict";
    
    /*
     * classList.js: Cross-browser full element.classList implementation.
    Severity: Major
    Found in dpc-admin/app/assets/javascripts/components/_accordions.js - About 6 hrs to fix

      Function 4 has a Cognitive Complexity of 43 (exceeds 11 allowed). Consider refactoring.
      Open

      },{}],4:[function(require,module,exports){
      /*
      object-assign
      (c) Sindre Sorhus
      @license MIT
      Severity: Minor
      Found in dpc-admin/app/assets/javascripts/components/_accordions.js - About 5 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 MacaroonBakery.java has 337 lines of code (exceeds 250 allowed). Consider refactoring.
      Confirmed

      package gov.cms.dpc.macaroons;
      
      import com.codahale.xsalsa20poly1305.SecretBox;
      import com.github.nitram509.jmacaroons.*;
      import gov.cms.dpc.macaroons.exceptions.BakeryException;
      Severity: Minor
      Found in dpc-macaroons/src/main/java/gov/cms/dpc/macaroons/MacaroonBakery.java - About 4 hrs to fix

        Class ApiClient has 28 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class ApiClient
          attr_reader :base_url, :response_body, :response_status
        
          def initialize
            @base_url = ENV.fetch('API_METADATA_URL')
        Severity: Minor
        Found in dpc-web/app/services/api_client.rb - About 3 hrs to fix

          Class ApiClient has 25 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class ApiClient
            attr_reader :base_url, :response_body, :response_status
          
            def initialize
              @base_url = ENV.fetch('API_METADATA_URL')
          Severity: Minor
          Found in dpc-admin/app/services/api_client.rb - About 2 hrs to fix

            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

              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

                    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 5 has a Cognitive Complexity of 23 (exceeds 11 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: 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

                      Method entityFromLine has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                      Confirmed

                          protected static Optional<ConsentEntity> entityFromLine(String line, String filename, int lineNum) throws InvalidSuppressionRecordException {
                              final int hicnStart = 0, hicnEnd = 11,
                                      effectiveDateStart = 354, effectiveDateEnd = 362,
                                      sourceCodeStart = 362, sourceCodeEnd = 367,
                                      prefIndicatorStart = 368, prefIndicatorEnd = 369;

                        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

                          Method API.RunGroupTests has 66 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func (api *API) RunGroupTests() {
                              const endpoint = "Group"
                          
                              // Create organization (and delete at the end) and setup accesstoken
                              auth := api.SetUpOrgAuth()
                          Severity: Minor
                          Found in dpc-testing/performance/pkg/dpc/test_group.go - About 1 hr to fix

                            Method fromFHIR has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                            Confirmed

                                @Override
                                public OrganizationEntity fromFHIR(FHIREntityConverter converter, Organization resource) {
                                    final OrganizationEntity entity = new OrganizationEntity();
                            
                                    // Add the profile metadata

                              Function 3 has a Cognitive Complexity of 19 (exceeds 11 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 1 hr 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

                              Method everything has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  @GET
                                  @FHIR
                                  @Path("/{patientID}/$everything")
                                  @PathAuthorizer(type = DPCResourceType.Patient, pathParam = "patientID")
                                  @Timed

                                Method processJobBatch has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    @Trace
                                    protected void processJobBatch(JobQueueBatch job) {
                                        final String queueCompleteTime = SplunkTimestamp.getSplunkTimestamp();
                                        try {
                                            MDC.put(MDCConstants.JOB_ID, job.getJobID().toString());
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language