CMSgov/dpc-app

View on GitHub

Showing 109 of 391 total issues

Method checkJobStatus has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Confirmed

    @Override
    @Path("/{jobID}")
    @GET
    @Timed
    @ExceptionMetered
Severity: Minor
Found in dpc-api/src/main/java/gov/cms/dpc/api/resources/v1/JobResource.java - 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

Function 9 has a Cognitive Complexity of 12 (exceeds 5 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: 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

Function 18 has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

},{}],18:[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 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());

      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();

        Function importResponseFile has 14 return statements (exceeds 4 allowed).
        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 1 hr to fix

          Method registerOrganization has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static String registerOrganization(IGenericClient client, IParser parser, String organizationID, String organizationNPI, String adminURL) throws IOException {
                  // Random number generator for Org NPI
                  // Register an organization, and a token
                  // Read in the test file
                  String macaroon;
          Severity: Minor
          Found in dpc-common/src/main/java/gov/cms/dpc/fhir/helpers/FHIRHelpers.java - About 1 hr to fix

            Method initialize has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                @Override
                public void initialize(Bootstrap<DPCConsentConfiguration> bootstrap) {
                    JerseyGuiceUtils.reset();
            
                    // Enable variable substitution with environment variables

              Function shouldUseNative has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function shouldUseNative() {
                try {
                  if (!Object.assign) {
                    return false;
                  }
              Severity: Minor
              Found in dpc-admin/app/assets/javascripts/components/_accordions.js - About 1 hr to fix

                Function searchFunc has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function searchFunc() {
                  var input, filter, ul, li, i, txtValue, div;
                  input = document.getElementById('searchInput');
                  filter = input.value.toUpperCase();
                  ul = document.getElementById('searchList');
                Severity: Minor
                Found in dpc-admin/app/assets/javascripts/components/_add-user-search.js - About 1 hr to fix

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

                      public Resource retrieveData(UUID organizationID,
                                                   String orgNPI,
                                                   String providerNPI,
                                                   List<String> patientMBIs,
                                                   OffsetDateTime since,
                  Severity: Major
                  Found in dpc-queue/src/main/java/gov/cms/dpc/queue/service/DataService.java - About 1 hr to fix

                    Method replaceRoster has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        @PUT
                        @Path("/{rosterID}")
                        @FHIR
                        @UnitOfWork
                        @Override

                      Function searchFunc has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function searchFunc() {
                        var input, filter, ul, li, i, txtValue, div;
                        input = document.getElementById('searchInput');
                        filter = input.value.toUpperCase();
                        ul = document.getElementById('searchList');
                      Severity: Minor
                      Found in dpc-admin/app/assets/javascripts/components/_add-user-search.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 fromCode has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public static DPCResourceType fromCode(String code) throws FHIRException {
                              if ("Bundle".equals(code))
                                  return Bundle;
                              if ("Coverage".equals(code))
                                  return Coverage;
                      Severity: Minor
                      Found in dpc-common/src/main/java/gov/cms/dpc/fhir/DPCResourceType.java - 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 authenticate has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Confirmed

                          @Override
                          public Optional<OrganizationPrincipal> authenticate(DPCAuthCredentials credentials) {
                              logger.debug("Performing token authentication");
                      
                              // If we don't have a path authorizer, just return the principal

                        Method checkJobStatus has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            @Override
                            @Path("/{jobID}")
                            @GET
                            @Timed
                            @ExceptionMetered
                        Severity: Minor
                        Found in dpc-api/src/main/java/gov/cms/dpc/api/resources/v1/JobResource.java - About 1 hr to fix

                          Method fromFhir has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              @SuppressWarnings("JdkObsolete") // Date class is used by FHIR stu3 Consent model
                              public static ConsentEntity fromFhir(Consent consent) {
                                  if (consent == null) {
                                      throw new WebApplicationException("No consent resource provided", Response.Status.BAD_REQUEST);
                                  }

                            Function getListeners has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            var getListeners = function getListeners(type, handler) {
                              var match = type.match(DELEGATE_PATTERN);
                              var selector;
                              if (match) {
                                type = match[1];
                            Severity: Minor
                            Found in dpc-admin/app/assets/javascripts/components/_accordions.js - About 1 hr to fix

                              Method API.RunTokenTests has 51 lines of code (exceeds 50 allowed). Consider refactoring.
                              Open

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