dpc-api/src/main/java/gov/cms/dpc/api/resources/v1/DataResource.java
Method buildRangedRequest
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
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)
Method buildRangedRequest
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
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();
- Read upRead up
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
Open
@Override
@Path("/{fileID}.ndjson")
@GET
@Timed
@ExceptionMetered
- Read upRead up
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"