guess-It-SDP/guessIt

View on GitHub

Showing 181 of 201 total issues

Similar blocks of code found in 4 locations. Consider refactoring.
Open

package com.github.freeman.bootcamp.wordle

import android.content.Context
import android.content.Intent
import androidx.activity.ComponentActivity
app/src/androidTest/java/com/github/freeman/bootcamp/wordle/WordleGameActivityHardTest.kt on lines 1..105
app/src/androidTest/java/com/github/freeman/bootcamp/wordle/WordleGameActivityMediumTest.kt on lines 1..105
app/src/androidTest/java/com/github/freeman/bootcamp/wordle/WordleGameActivityVeryHardTest.kt on lines 1..103

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 914.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

package com.github.freeman.bootcamp.wordle

import android.content.Context
import android.content.Intent
import androidx.activity.ComponentActivity
app/src/androidTest/java/com/github/freeman/bootcamp/wordle/WordleGameActivityHardTest.kt on lines 1..105
app/src/androidTest/java/com/github/freeman/bootcamp/wordle/WordleGameActivityVeryHardTest.kt on lines 1..103
app/src/androidTest/java/com/github/freeman/bootcamp/wordle/WordleGameActivityVeryVeryHardTest.kt on lines 1..116

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 914.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

package com.github.freeman.bootcamp.wordle

import android.content.Context
import android.content.Intent
import androidx.activity.ComponentActivity
app/src/androidTest/java/com/github/freeman/bootcamp/wordle/WordleGameActivityHardTest.kt on lines 1..105
app/src/androidTest/java/com/github/freeman/bootcamp/wordle/WordleGameActivityMediumTest.kt on lines 1..105
app/src/androidTest/java/com/github/freeman/bootcamp/wordle/WordleGameActivityVeryVeryHardTest.kt on lines 1..116

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 914.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

package com.github.freeman.bootcamp.wordle

import android.content.Context
import android.content.Intent
import androidx.activity.ComponentActivity
app/src/androidTest/java/com/github/freeman/bootcamp/wordle/WordleGameActivityMediumTest.kt on lines 1..105
app/src/androidTest/java/com/github/freeman/bootcamp/wordle/WordleGameActivityVeryHardTest.kt on lines 1..103
app/src/androidTest/java/com/github/freeman/bootcamp/wordle/WordleGameActivityVeryVeryHardTest.kt on lines 1..116

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 914.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method EditDialog has a Cognitive Complexity of 81 (exceeds 20 allowed). Consider refactoring.
Open

// Dialog that edits any field given in argument
@Composable
fun EditDialog(
    text: MutableState<String>,
    setValue: String = SET_VALUE,
Severity: Minor
Found in app/src/main/java/com/github/freeman/bootcamp/EditProfileActivity.kt - About 1 day 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 onStartCommand has a Cognitive Complexity of 70 (exceeds 20 allowed). Consider refactoring.
Open

    override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
        if (firstStart) {
            Log.d("GameManagerD", "Game Manager Started")
            val gameID = intent!!.getStringExtra(getString(R.string.gameId_extra)).toString()
            val gameDBRef = getGameDBRef(this, gameID)

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 EditUserDetails has a Cognitive Complexity of 57 (exceeds 20 allowed). Consider refactoring.
Open

@Composable
fun EditUserDetails(context: Context = LocalContext.current, displayName: MutableState<String>, profilePic: MutableState<Bitmap?>) {
    val dbRef = Firebase.database.reference
    val storageRef = Firebase.storage.reference
    val userId = Firebase.auth.currentUser?.uid
Severity: Minor
Found in app/src/main/java/com/github/freeman/bootcamp/EditProfileActivity.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

Similar blocks of code found in 3 locations. Consider refactoring.
Open

@Composable
fun TopAppbarGuessItRules(context: Context = LocalContext.current) {

    TopAppBar(
        modifier = Modifier.testTag("topAppbarGuessItRules"),
app/src/main/java/com/github/freeman/bootcamp/games/help/CreditsActivity.kt on lines 119..150
app/src/main/java/com/github/freeman/bootcamp/games/help/WordleRulesActivity.kt on lines 125..156

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 407.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

@Composable
fun TopAppbarCredits(context: Context = LocalContext.current) {

    TopAppBar(
        modifier = Modifier.testTag("topAppbarCredits"),
app/src/main/java/com/github/freeman/bootcamp/games/help/GuessItRulesActivity.kt on lines 112..143
app/src/main/java/com/github/freeman/bootcamp/games/help/WordleRulesActivity.kt on lines 125..156

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 407.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

@Composable
fun TopAppbarWordleRules(context: Context = LocalContext.current) {

    TopAppBar(
        modifier = Modifier.testTag("topAppbarWordleRules"),
app/src/main/java/com/github/freeman/bootcamp/games/help/CreditsActivity.kt on lines 119..150
app/src/main/java/com/github/freeman/bootcamp/games/help/GuessItRulesActivity.kt on lines 112..143

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 407.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method createRecap has a Cognitive Complexity of 54 (exceeds 20 allowed). Consider refactoring.
Open

        /**
         * Creates a recap video for the given game
         *
         * @param context context of the app
         * @param gameId id of the game

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 EditProfileActivity.kt has 412 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package com.github.freeman.bootcamp

import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
Severity: Minor
Found in app/src/main/java/com/github/freeman/bootcamp/EditProfileActivity.kt - About 5 hrs to fix

    Method AuthenticationForm has a Cognitive Complexity of 49 (exceeds 20 allowed). Consider refactoring.
    Open

    /**
     * Display authentication info and authentication buttons depending on the user authentication state
     * @param signInInfo the sign in info that will be displayed
     * @param currentUser the current user, can be anonymous
     */

    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 EditDialog has 114 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    // Dialog that edits any field given in argument
    @Composable
    fun EditDialog(
        text: MutableState<String>,
        setValue: String = SET_VALUE,
    Severity: Major
    Found in app/src/main/java/com/github/freeman/bootcamp/EditProfileActivity.kt - About 4 hrs to fix

      File FirebaseAuthActivity.kt has 329 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      package com.github.freeman.bootcamp.auth
      
      import android.app.Activity
      import android.content.Context
      import android.content.Intent

        Method onCreate has a Cognitive Complexity of 39 (exceeds 20 allowed). Consider refactoring.
        Open

            override fun onCreate(savedInstanceState: Bundle?) {
                super.onCreate(savedInstanceState)
        
                signInLauncher = registerForActivityResult (
                    FirebaseAuthUIActivityResultContract()

        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 onStartCommand has 85 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
                if (firstStart) {
                    Log.d("GameManagerD", "Game Manager Started")
                    val gameID = intent!!.getStringExtra(getString(R.string.gameId_extra)).toString()
                    val gameDBRef = getGameDBRef(this, gameID)

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

              @Test
              fun lobbiesListTopAppBar() {
                  composeRule.onNodeWithText(PLAY).performClick()
                  composeRule.onNodeWithText("Guess It!").performClick()
                  composeRule.onNodeWithText("Join", substring = true).performClick()
          app/src/androidTest/java/com/github/freeman/bootcamp/TopAppBarsTest.kt on lines 134..146
          app/src/androidTest/java/com/github/freeman/bootcamp/TopAppBarsTest.kt on lines 190..202

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 231.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

              @Test
              fun publicPrivateLobbyTopAppBar() {
                  composeRule.onNodeWithText(PLAY).performClick()
                  composeRule.onNodeWithText("Guess It!").performClick()
                  composeRule.onNodeWithText("Create", substring = true).performClick()
          app/src/androidTest/java/com/github/freeman/bootcamp/TopAppBarsTest.kt on lines 163..175
          app/src/androidTest/java/com/github/freeman/bootcamp/TopAppBarsTest.kt on lines 190..202

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 231.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

              @Test
              fun wordleGameTopAppBar() {
                  composeRule.onNodeWithText(PLAY).performClick()
                  composeRule.onNodeWithText("Wordle").performClick()
                  composeRule.onNodeWithText("Easy", substring = true).performClick()
          app/src/androidTest/java/com/github/freeman/bootcamp/TopAppBarsTest.kt on lines 134..146
          app/src/androidTest/java/com/github/freeman/bootcamp/TopAppBarsTest.kt on lines 163..175

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 231.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Severity
          Category
          Status
          Source
          Language