CMSgov/dpc-app

View on GitHub

Showing 50 of 220 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 DpcClient has 28 methods (exceeds 20 allowed). Consider refactoring.
        Open

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

          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;

            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

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

                                  private Response buildRangedRequest(String fileID, File file, RangeHeader range) {
                                      if (!range.getUnit().equals(ACCEPTED_RANGE_VALUE)) {
                                          throw new WebApplicationException("Only `bytes` are acceptable as ranges", Response.Status.REQUESTED_RANGE_NOT_SATISFIABLE);
                                      }
                                      final long rangeStart = range.getStart() < 0 ? 0 : range.getStart();

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

                                    public List<JobQueueBatchFile> processJobBatchPartial(UUID aggregatorID, IJobQueue queue, JobQueueBatch job, String patientID) {
                                        StopWatch stopWatch = StopWatch.createStarted();
                                        OutcomeReason failReason = null;
                                        final Pair<Optional<List<ConsentResult>>, Optional<OperationOutcome>> consentResult = getConsent(patientID);
                                
                                
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language