cook4me/android

View on GitHub

Showing 19 of 61 total issues

Method SignUpScreen has a Cognitive Complexity of 56 (exceeds 20 allowed). Consider refactoring.
Open

@Composable
fun SignUpScreen(
    modifier: Modifier = Modifier,
    accountService: AccountService = AccountService(),
    onSuccessfulAccountCreationAndLogin: () -> Unit
Severity: Minor
Found in app/src/main/java/ch/epfl/sdp/cook4me/ui/user/signup/SignUpScreen.kt - About 6 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

Method VoteIcon has a Cognitive Complexity of 53 (exceeds 20 allowed). Consider refactoring.
Open

/**
 * Component that shows an upvote/downvote icon (similar to reddit f.ex)
 * @param counterValue the current value of the counter
 * @param onChange the function that will be called when the counter changes, the int parameter is the relative change
 * @param userVote the current vote of the user (0 if none, 1 if upvote, -1 if downvote)
Severity: Minor
Found in app/src/main/java/ch/epfl/sdp/cook4me/ui/recipe/feed/VoteIcon.kt - About 5 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

Method LoginScreen has a Cognitive Complexity of 35 (exceeds 20 allowed). Consider refactoring.
Open

@Composable
fun LoginScreen(
    onSuccessfulLogin: () -> Unit,
    onRegisterClick: () -> Unit,
    modifier: Modifier = Modifier,
Severity: Minor
Found in app/src/main/java/ch/epfl/sdp/cook4me/ui/user/LoginScreen.kt - 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

Method Cook4MeApp has a Cognitive Complexity of 33 (exceeds 20 allowed). Consider refactoring.
Open

@Composable
fun Cook4MeApp(
    navController: NavHostController = rememberNavController(),
    permissionStatusProvider: PermissionStatusProvider = ComposePermissionStatusProvider(
        listOf(Manifest.permission.CAMERA, Manifest.permission.ACCESS_FINE_LOCATION)
Severity: Minor
Found in app/src/main/java/ch/epfl/sdp/cook4me/Cook4MeApp.kt - 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

Method RecipeListScreen has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
Open

/**
 * Displays a scrollable list of recipes
 * @param recipeList the list of (id with the recipe) with the note to display
 * @param onNoteUpdate the function to call when the note is updated (recipeId, note)
 * @param userVotes the map of the user votes (recipeId, note) if no votes -> empty key

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 VoteIcon has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    modifier: Modifier = Modifier,
    counterValue: Int = 0,
    onChange: (Int) -> Unit = {},
    userVote: Int = 0,
    canClick: Boolean = true,
Severity: Minor
Found in app/src/main/java/ch/epfl/sdp/cook4me/ui/recipe/feed/VoteIcon.kt - About 45 mins to fix

    Method AddressField has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
    Open

    /**
     * A component that asks for an address
     * @param question the question to be displayed
     * @param onAddressChanged the function to be called when the address is changed
     */
    Severity: Minor
    Found in app/src/main/java/ch/epfl/sdp/cook4me/ui/event/form/AddressField.kt - 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 FormButtons has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        @StringRes onCancelText: Int,
        @StringRes onSaveText: Int,
        modifier: Modifier = Modifier,
        isLoading: Boolean = false,
        onCancelClick: () -> Unit,
    Severity: Minor
    Found in app/src/main/java/ch/epfl/sdp/cook4me/ui/common/form/FormButtons.kt - About 45 mins to fix

      Method InputField has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          value: String,
          @StringRes question: Int,
          modifier: Modifier = Modifier,
          @StringRes label: Int? = null,
          isError: Boolean = false,
      Severity: Minor
      Found in app/src/main/java/ch/epfl/sdp/cook4me/ui/common/form/Fields.kt - About 45 mins to fix

        Method BiosField has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            icon: ImageVector,
            preview: String,
            value: String,
            isError: Boolean,
            onNewValue: (String) -> Unit,
        Severity: Minor
        Found in app/src/main/java/ch/epfl/sdp/cook4me/ui/common/form/Fields.kt - About 45 mins to fix

          Method MatchDialog has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
          Open

          @Composable
          fun MatchDialog(
              user: String,
              otherUser: String,
              context: Context,
          Severity: Minor
          Found in app/src/main/java/ch/epfl/sdp/cook4me/ui/tupperware/swipe/MatchDialog.kt - 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 ProfileInfosField has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              icon: ImageVector,
              preview: String,
              value: String,
              isError: Boolean,
              onNewValue: (String) -> Unit,
          Severity: Minor
          Found in app/src/main/java/ch/epfl/sdp/cook4me/ui/common/form/Fields.kt - About 45 mins to fix

            Method RecipeListScreen has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                recipeList: List<RecipeNote>,
                onNoteUpdate: (String, Int) -> Unit,
                userVotes: Map<String, Int>,
                isOnline: Boolean = true,
                recipeImages: Map<String, ByteArray?>
            Severity: Minor
            Found in app/src/main/java/ch/epfl/sdp/cook4me/ui/recipe/feed/RecipeListScreen.kt - About 35 mins to fix

              Method PasswordField has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  value: String,
                  isError: Boolean,
                  onNewValue: (String) -> Unit,
                  modifier: Modifier = Modifier,
                  @StringRes text: Int? = null
              Severity: Minor
              Found in app/src/main/java/ch/epfl/sdp/cook4me/ui/common/form/Fields.kt - About 35 mins to fix

                Method MatchDialog has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    user: String,
                    otherUser: String,
                    context: Context,
                    onDismissRequest: () -> Unit,
                    profileImageRepository: ProfileImageRepository = ProfileImageRepository()
                Severity: Minor
                Found in app/src/main/java/ch/epfl/sdp/cook4me/ui/tupperware/swipe/MatchDialog.kt - About 35 mins to fix

                  Method RecipeFeed has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
                  Open

                  /**
                   * Displays the recipe feed screen
                   * @param service the service to use to get the recipes/notes and update the notes
                   * @param onCreateNewRecipe the callback to call when the user wants to create a new recipe
                   */
                  Severity: Minor
                  Found in app/src/main/java/ch/epfl/sdp/cook4me/ui/recipe/feed/RecipeFeed.kt - About 35 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

                  Avoid too many return statements within this method.
                  Open

                          if (user != other.user) return false
                  Severity: Major
                  Found in app/src/main/java/ch/epfl/sdp/cook4me/persistence/model/Tupperware.kt - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                            return true
                    Severity: Major
                    Found in app/src/main/java/ch/epfl/sdp/cook4me/persistence/model/Tupperware.kt - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                              if (!image.contentEquals(other.image)) return false
                      Severity: Major
                      Found in app/src/main/java/ch/epfl/sdp/cook4me/persistence/model/Tupperware.kt - About 30 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language