CMSgov/dpc-app

View on GitHub
dpc-api/src/main/java/gov/cms/dpc/api/resources/v1/DataResource.java

Summary

Maintainability
A
2 hrs
Test Coverage
A
90%

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 downloadExportFile has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Wontfix

        public Response downloadExportFile(@ApiParam(hidden = true) @Auth OrganizationPrincipal organizationPrincipal,
                                           @HeaderParam(HttpHeaders.RANGE)
                                           @ApiParam(value = "HTTP Range request for partial file download", example = "bytes=0-1234")
                                                   RangeHeader rangeHeader,
                                           @HeaderParam(HttpHeaders.IF_NONE_MATCH)
    Severity: Minor
    Found in dpc-api/src/main/java/gov/cms/dpc/api/resources/v1/DataResource.java - About 35 mins to fix

      Method buildRangedRequest has a Cognitive Complexity of 7 (exceeds 5 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();
      Severity: Minor
      Found in dpc-api/src/main/java/gov/cms/dpc/api/resources/v1/DataResource.java - About 35 mins 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 downloadExportFile has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

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

      There are no issues that match your filters.

      Category
      Status