SDP-GeoHunt/geo-hunt

View on GitHub

Showing 168 of 168 total issues

Method ChallengeFeed has a Cognitive Complexity of 77 (exceeds 20 allowed). Consider refactoring.
Open

@Composable
fun ChallengeFeed(
    chosenFeed: HomeScreenFeed,
    onUserClick: (User) -> Unit,
    onOpenMap: (Challenge) -> Unit,

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

@Composable
internal fun ChallengeViewAuthor(
    doFollow: () -> Unit,
    doUnfollow: () -> Unit,
    state: ChallengeViewModel.State

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

/**
 * Creates the bottom navigation bar of the application.
 *
 * @param navController The navigation controller.
 * @param onCreate Callback used by the create button.

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

@SuppressLint("FlowOperatorInvokedInComposition")
@OptIn(ExperimentalMaterialApi::class)
@Composable
fun BountiesFeed(
    onUserClick: (User) -> Unit,

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

@OptIn(ExperimentalMaterial3Api::class, ExperimentalFoundationApi::class)
@Composable
fun TeamProgressScreenContent(
    onBack: () -> Unit,
    onLeaderboard: () -> Unit,

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

Identical blocks of code found in 2 locations. Consider refactoring.
Open

) {
    val challenge = viewModel.challenge.collectAsState()

    LaunchedEffect(cid, viewModel) {
        viewModel.start(cid, onFailure)
app/src/main/java/com/github/geohunt/app/ui/components/bounties/BountyClaimChallenge.kt on lines 27..49

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 255.

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

Identical blocks of code found in 2 locations. Consider refactoring.
Open

) {
    val challenge = viewModel.challenge.collectAsState()

    LaunchedEffect(cid, viewModel) {
        viewModel.start(cid, onFailure)
app/src/main/java/com/github/geohunt/app/ui/components/claims/ClaimChallenge.kt on lines 19..41

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 255.

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

@Composable
internal fun ChallengeViewAuthor(
    doFollow: () -> Unit,
    doUnfollow: () -> Unit,
    state: ChallengeViewModel.State

    Method BelowImageButton has a Cognitive Complexity of 38 (exceeds 20 allowed). Consider refactoring.
    Open

    @Composable
    internal fun BelowImageButton(
        joinHunt: () -> Unit,
        leaveHunt: () -> Unit,
        fnClaimHuntCallback: (String) -> Unit,

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

    @Composable
    fun BountyChallengeCard(
        challenge: Challenge?,
        currentLocation: Location?,
        onClaim: (Challenge) -> Unit,

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

        override fun onCreate(savedInstanceState: Bundle?) {
            super.onCreate(savedInstanceState)
    
            setContent {
                GeoHuntTheme {
    Severity: Minor
    Found in app/src/main/java/com/github/geohunt/app/TutorialActivity.kt - About 3 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 BountyChallengeCard has 75 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    @Composable
    fun BountyChallengeCard(
        challenge: Challenge?,
        currentLocation: Location?,
        onClaim: (Challenge) -> Unit,

      Method SettingsDrawer has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring.
      Open

      @Composable
      fun SettingsDrawer(
          openProfileEdit: OptionalCallback,
          openLeaderboard: OptionalCallback,
          onLogout: OptionalCallback,

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

      @OptIn(ExperimentalFoundationApi::class)
      @Composable
      fun HomeBountyCard(
          author: Flow<User?>,
          onUserClick: (User) -> Unit,

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

      /**
       * A team entry in the team selector
       *
       * @param name The team's name
       * @param users the list of users, if any

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

      @OptIn(ExperimentalMaterial3Api::class, ExperimentalFoundationApi::class)
      @Composable
      fun TeamProgressScreenContent(
          onBack: () -> Unit,
          onLeaderboard: () -> Unit,

        Method TeamsSelector has a Cognitive Complexity of 34 (exceeds 20 allowed). Consider refactoring.
        Open

        @Composable
        fun TeamsSelector(
            teams: List<Team>?,
            users: Map<String, List<User>>,
            join: (Team) -> Unit,

        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

                RadioItem(
                    title = stringResource(id = R.string.private_word),
                    subtitle = stringResource(id = R.string.private_desc),
                    isSelected = visibility.value == ProfileVisibility.PRIVATE,
                    value = ProfileVisibility.PRIVATE,
        app/src/main/java/com/github/geohunt/app/ui/settings/privacy_settings/ProfileVisibilityChooser.kt on lines 21..29
        app/src/main/java/com/github/geohunt/app/ui/settings/privacy_settings/ProfileVisibilityChooser.kt on lines 30..38

        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 184.

        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

                RadioItem(
                    title = stringResource(id = R.string.public_word),
                    subtitle = stringResource(id = R.string.public_desc),
                    isSelected = visibility.value == ProfileVisibility.PUBLIC,
                    value = ProfileVisibility.PUBLIC,
        app/src/main/java/com/github/geohunt/app/ui/settings/privacy_settings/ProfileVisibilityChooser.kt on lines 30..38
        app/src/main/java/com/github/geohunt/app/ui/settings/privacy_settings/ProfileVisibilityChooser.kt on lines 39..47

        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 184.

        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

                RadioItem(
                    title = stringResource(id = R.string.following_only),
                    subtitle = stringResource(id = R.string.following_only_desc),
                    isSelected = visibility.value == ProfileVisibility.FOLLOWING_ONLY,
                    value = ProfileVisibility.FOLLOWING_ONLY,
        app/src/main/java/com/github/geohunt/app/ui/settings/privacy_settings/ProfileVisibilityChooser.kt on lines 21..29
        app/src/main/java/com/github/geohunt/app/ui/settings/privacy_settings/ProfileVisibilityChooser.kt on lines 39..47

        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 184.

        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