Showing 92 of 120 total issues
Recipe
has 54 methods (exceeds 20 allowed). Consider refactoring. 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;
File UploadingRecipeFragment.java
has 464 lines of code (exceeds 250 allowed). Consider refactoring. Open
package com.github.siela1915.bootcamp.UploadRecipe;
import android.Manifest;
import android.app.Activity;
import android.app.ProgressDialog;
File LanguageFilter.java
has 463 lines of code (exceeds 250 allowed). Consider refactoring. Open
package com.github.siela1915.bootcamp.Tools;
import com.github.siela1915.bootcamp.Recipes.Comment;
import java.util.ArrayList;
Database
has 38 methods (exceeds 20 allowed). Consider refactoring. Open
public class Database {
private final DatabaseReference db;
public final static String RECIPES = "recipes",
FAVORITES = "favorites",
Consider simplifying this complex logical expression. Open
if (obj instanceof Recipe) {
Recipe recipe = (Recipe) obj;
boolean temp0 = Objects.equals(image, recipe.image)
&& recipeName.equals(recipe.recipeName)
&& userName.equals(recipe.userName);
File MainHomeActivity.java
has 341 lines of code (exceeds 250 allowed). Consider refactoring. Open
package com.github.siela1915.bootcamp;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.Intent;
UploadingRecipeFragment
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
public class UploadingRecipeFragment extends Fragment {
private final String storagePath = "gs://dish-delish-recipes.appspot.com";
private static final int CHOOSE_IMAGE_FROM_GALLERY_REQUEST = 111;
private static final int TAKE_PHOTO_REQUEST = 222;
private View view;
File HomePageFragment.java
has 289 lines of code (exceeds 250 allowed). Consider refactoring. Open
package com.github.siela1915.bootcamp;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.graphics.Paint;
Method onCreate
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
@SuppressLint({"MissingInflatedId", "NonConstantResourceId"})
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- 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 NearbyHelpFragment.java
has 279 lines of code (exceeds 250 allowed). Consider refactoring. Open
package com.github.siela1915.bootcamp;
import static android.content.Context.LAYOUT_INFLATER_SERVICE;
import static com.google.android.gms.location.Priority.PRIORITY_BALANCED_POWER_ACCURACY;
Method equals
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. 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
package com.github.siela1915.bootcamp.Recipes;
import android.os.Parcel;
import android.os.Parcelable;
Method isIngredientValid
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public boolean isIngredientValid() {
for (int i = 0; i < ingredientLinearLayout.getChildCount(); i++) {
if (ingredientLinearLayout.getChildAt(i) instanceof ConstraintLayout) {
ConstraintLayout step = (ConstraintLayout) ingredientLinearLayout.getChildAt(i);
if (step.getChildAt(0) instanceof TextInputLayout && step.getChildAt(1) instanceof TextInputLayout && step.getChildAt(2) instanceof TextInputLayout) {
- 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 onViewCreated
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
@SuppressLint({"SetTextI18n", "MissingPermission"})
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
Method setPageContents
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void setPageContents() {
ImageView recipePicture = (ImageView) findViewById(R.id.recipePicture);
TextView recipeNameText = (TextView) findViewById(R.id.recipeNameText);
ImageView userAvatar = (ImageView) findViewById(R.id.userAvatar);
Method onCreate
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
protected void onCreate(Bundle savedInstanceState) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
Method addListeners
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void addListeners(View view) {
Button uploadImg = (Button) view.findViewById(R.id.recipeUploadButton);
imgView = (ImageView) view.findViewById(R.id.recipeImageContent);
Button addStep = (Button) view.findViewById(R.id.addStepButton);
TextInputLayout recipeNameLayout = view.findViewById(R.id.recipeNameContent);
Method onCreateDialog
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = requireActivity().getLayoutInflater();
Function sendNotification
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
.onCreate(async (data, context) => {
const notificationId = context.params.notificationId;
const notif = data.val();
const getDeviceTokensPromise = admin.database()
.ref(`/users/${notif.receiver}/tokens`).once("value");
Method getDatabase
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
@SuppressLint("VisibleForTests")
public static FirebaseDatabase getDatabase(Context context) {
if (db == null) {
db = FirebaseDatabase.getInstance();
}
- 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"