DishDelish/dishdelish-app

View on GitHub

Showing 56 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;
Severity: Major
Found in app/src/main/java/com/github/siela1915/bootcamp/Recipes/Recipe.java - About 7 hrs to fix

    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);
          Severity: Critical
          Found in app/src/main/java/com/github/siela1915/bootcamp/Recipes/Recipe.java - About 4 hrs to fix

            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;
            Severity: Minor
            Found in app/src/main/java/com/github/siela1915/bootcamp/MainHomeActivity.java - About 4 hrs to fix

              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;
                Severity: Minor
                Found in app/src/main/java/com/github/siela1915/bootcamp/HomePageFragment.java - About 2 hrs to fix

                  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);
                  
                  
                  Severity: Minor
                  Found in app/src/main/java/com/github/siela1915/bootcamp/MainHomeActivity.java - About 2 hrs 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

                  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)
                    Severity: Minor
                    Found in app/src/main/java/com/github/siela1915/bootcamp/Recipes/Recipe.java - About 2 hrs 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

                    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;
                    
                    
                    Severity: Minor
                    Found in app/src/main/java/com/github/siela1915/bootcamp/Recipes/Recipe.java - About 2 hrs to fix

                      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) {

                      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);
                      
                      
                      Severity: Major
                      Found in app/src/main/java/com/github/siela1915/bootcamp/MyFridgeFragment.java - About 2 hrs to fix

                        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);
                        Severity: Major
                        Found in app/src/main/java/com/github/siela1915/bootcamp/RecipeActivity.java - About 2 hrs to fix

                          Method onCreate has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              @Override
                              protected void onCreate(Bundle savedInstanceState) {
                                  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
                          
                          
                          
                          Severity: Major
                          Found in app/src/main/java/com/github/siela1915/bootcamp/CookNowActivity.java - About 2 hrs to fix

                            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");
                                Severity: Minor
                                Found in functions/src/index.ts - About 1 hr to fix

                                  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();
                                          }

                                  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