McPringle/sportchef

View on GitHub

Showing 7 of 86 total issues

Method checkColorThreshold has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    private static Color checkColorThreshold(@NotNull final Color color) {
        int averageRed = color.getRed();
        int averageGreen = color.getGreen();
        int averageBlue = color.getBlue();
        long averageColor = averageRed + averageGreen + averageBlue;
Severity: Minor
Found in src/main/java/ch/sportchef/business/AverageColorCalculator.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 resizeAndCrop has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public static BufferedImage resizeAndCrop(final BufferedImage inputImage,
                                              final int outputWidth, final int outputHeight) {

        final double outputAspectRatio = outputWidth / (double) outputHeight;

Severity: Minor
Found in src/main/java/ch/sportchef/business/ImageResizer.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 saveWithSuccess has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Test
    public void saveWithSuccess() throws URISyntaxException {
        // arrange
        final Event eventToCreate = Event.builder()
                .eventId(0L)

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

    public static BufferedImage resizeAndCrop(final BufferedImage inputImage,
                                              final int outputWidth, final int outputHeight) {

        final double outputAspectRatio = outputWidth / (double) outputHeight;

Severity: Minor
Found in src/main/java/ch/sportchef/business/ImageResizer.java - About 1 hr to fix

Method searchForError has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    private Error searchForError(@NotNull final Throwable cause) {
        Error error = null;

        if (cause instanceof ConcurrentModificationException) {
            error = new Error(CONFLICT, cause);
Severity: Minor
Found in src/main/java/ch/sportchef/business/RuntimeExceptionMapper.java - About 45 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 crop has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public static BufferedImage crop(final BufferedImage inputImage,
                                     final int startX, final int startY,
                                     final int outputWidth, final int outputHeight) {
Severity: Minor
Found in src/main/java/ch/sportchef/business/ImageResizer.java - About 35 mins to fix

Method requestChallenge has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    @GET
    @Consumes({MediaType.WILDCARD})
    public Response requestChallenge(@QueryParam("email") final String email) {
        final Response response;

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

Severity
Category
Status
Source
Language