app/src/main/java/com/github/siela1915/bootcamp/Recipes/Recipe.java
Recipe
has 54 methods (exceeds 20 allowed). Consider refactoring. Open
Open
public class Recipe implements Parcelable {
public String image, recipeName, userName, uniqueKey = "";
public String userId = "";
public int profilePicture, prepTime, cookTime, servings, likes, numRatings = 0;
public double rating;
Consider simplifying this complex logical expression. Open
Open
if (obj instanceof Recipe) {
Recipe recipe = (Recipe) obj;
boolean temp0 = Objects.equals(image, recipe.image)
&& recipeName.equals(recipe.recipeName)
&& userName.equals(recipe.userName);
Method equals
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
Open
@Override
public boolean equals(Object obj) {
if (obj instanceof Recipe) {
Recipe recipe = (Recipe) obj;
boolean temp0 = Objects.equals(image, recipe.image)
- 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
File Recipe.java
has 268 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
package com.github.siela1915.bootcamp.Recipes;
import android.os.Parcel;
import android.os.Parcelable;