bastienrobert/la-ferme

View on GitHub

Showing 178 of 214 total issues

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

export async function down(knex: Knex): Promise<any> {
  await knex.schema.dropTable('users')

  return
}
Severity: Major
Found in packages/server/db/migrate/20200403110224_create_users.ts and 12 other locations - About 35 mins to fix
packages/server/db/migrate/20200401174604_create_rooms.ts on lines 15..19
packages/server/db/migrate/20200401181734_create_games.ts on lines 19..23
packages/server/db/migrate/20200403110256_create_players.ts on lines 26..30
packages/server/db/migrate/20200403110303_create_rounds.ts on lines 21..25
packages/server/db/migrate/20200403110315_create_connections.ts on lines 15..19
packages/server/db/migrate/20200430114405_create_reports.ts on lines 29..33
packages/server/db/migrate/20200430155210_create_rounds_targets.ts on lines 16..20
packages/server/db/migrate/20200501184432_create_skills.ts on lines 14..18
packages/server/db/migrate/20200502014843_create_skills_targets.ts on lines 12..16
packages/server/db/migrate/20200502286754_create_regularizations.ts on lines 15..19
packages/server/db/migrate/20200627123512_create_mini_games.ts on lines 19..23
packages/server/db/migrate/20200627123652_create_mini_game_players.ts on lines 14..18

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

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 13 locations. Consider refactoring.
Open

export async function down(knex: Knex): Promise<any> {
  await knex.schema.dropTable('connections')

  return
}
packages/server/db/migrate/20200401174604_create_rooms.ts on lines 15..19
packages/server/db/migrate/20200401181734_create_games.ts on lines 19..23
packages/server/db/migrate/20200403110224_create_users.ts on lines 18..22
packages/server/db/migrate/20200403110256_create_players.ts on lines 26..30
packages/server/db/migrate/20200403110303_create_rounds.ts on lines 21..25
packages/server/db/migrate/20200430114405_create_reports.ts on lines 29..33
packages/server/db/migrate/20200430155210_create_rounds_targets.ts on lines 16..20
packages/server/db/migrate/20200501184432_create_skills.ts on lines 14..18
packages/server/db/migrate/20200502014843_create_skills_targets.ts on lines 12..16
packages/server/db/migrate/20200502286754_create_regularizations.ts on lines 15..19
packages/server/db/migrate/20200627123512_create_mini_games.ts on lines 19..23
packages/server/db/migrate/20200627123652_create_mini_game_players.ts on lines 14..18

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

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

  const reportCount = Number(
    await player
      .receivedReports()
      .where({ status: ReportStatus.Completed }, false)
      .count()
Severity: Minor
Found in packages/server/app/engine/getStatistics.ts and 2 other locations - About 35 mins to fix
packages/server/app/engine/getStatistics.ts on lines 113..118
packages/server/app/engine/getStatistics.ts on lines 119..124

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

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 2 locations. Consider refactoring.
Open

    if (skillError?.length > 0) {
      alert.error(error(skillError[0].message))
      set(undefined)
      return
    }
Severity: Minor
Found in packages/mobile/src/pages/Game/Main/Popup/Skill/index.tsx and 1 other location - About 35 mins to fix
packages/mobile/src/pages/Game/Main/Popup/Report/index.tsx on lines 36..40

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

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 2 locations. Consider refactoring.
Open

  useLayoutEffect(() => {
    viewport.on('resize', callback)
    return () => {
      viewport.off('resize', callback)
    }
Severity: Minor
Found in packages/website/src/hooks/useOnResize.ts and 1 other location - About 35 mins to fix
packages/website/src/hooks/useMenu.ts on lines 7..12

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

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 13 locations. Consider refactoring.
Open

export async function down(knex: Knex): Promise<any> {
  await knex.schema.dropTable('skills')

  return
}
Severity: Major
Found in packages/server/db/migrate/20200501184432_create_skills.ts and 12 other locations - About 35 mins to fix
packages/server/db/migrate/20200401174604_create_rooms.ts on lines 15..19
packages/server/db/migrate/20200401181734_create_games.ts on lines 19..23
packages/server/db/migrate/20200403110224_create_users.ts on lines 18..22
packages/server/db/migrate/20200403110256_create_players.ts on lines 26..30
packages/server/db/migrate/20200403110303_create_rounds.ts on lines 21..25
packages/server/db/migrate/20200403110315_create_connections.ts on lines 15..19
packages/server/db/migrate/20200430114405_create_reports.ts on lines 29..33
packages/server/db/migrate/20200430155210_create_rounds_targets.ts on lines 16..20
packages/server/db/migrate/20200502014843_create_skills_targets.ts on lines 12..16
packages/server/db/migrate/20200502286754_create_regularizations.ts on lines 15..19
packages/server/db/migrate/20200627123512_create_mini_games.ts on lines 19..23
packages/server/db/migrate/20200627123652_create_mini_game_players.ts on lines 14..18

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

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 2 locations. Consider refactoring.
Open

  useLayoutEffect(() => {
    menu.on('change', setSection)
    return () => {
      menu.off('change', setSection)
    }
Severity: Minor
Found in packages/website/src/hooks/useMenu.ts and 1 other location - About 35 mins to fix
packages/website/src/hooks/useOnResize.ts on lines 5..10

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

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

      pubsub.publish(PLAYER.READY, {
        gameUpdated: {
          gameUUID: game.uuid,
          type: GameStatusType.Ready,
          players: formattedPlayers
Severity: Minor
Found in packages/server/app/graphql/resolvers/player.ts and 2 other locations - About 35 mins to fix
packages/server/app/engine/checkRegularization.ts on lines 47..53
packages/server/app/graphql/resolvers/game.ts on lines 105..111

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

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 13 locations. Consider refactoring.
Open

export async function down(knex: Knex): Promise<any> {
  await knex.schema.dropTable('players')

  return
}
Severity: Major
Found in packages/server/db/migrate/20200403110256_create_players.ts and 12 other locations - About 35 mins to fix
packages/server/db/migrate/20200401174604_create_rooms.ts on lines 15..19
packages/server/db/migrate/20200401181734_create_games.ts on lines 19..23
packages/server/db/migrate/20200403110224_create_users.ts on lines 18..22
packages/server/db/migrate/20200403110303_create_rounds.ts on lines 21..25
packages/server/db/migrate/20200403110315_create_connections.ts on lines 15..19
packages/server/db/migrate/20200430114405_create_reports.ts on lines 29..33
packages/server/db/migrate/20200430155210_create_rounds_targets.ts on lines 16..20
packages/server/db/migrate/20200501184432_create_skills.ts on lines 14..18
packages/server/db/migrate/20200502014843_create_skills_targets.ts on lines 12..16
packages/server/db/migrate/20200502286754_create_regularizations.ts on lines 15..19
packages/server/db/migrate/20200627123512_create_mini_games.ts on lines 19..23
packages/server/db/migrate/20200627123652_create_mini_game_players.ts on lines 14..18

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

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

      const uncivil = Number(
        await player
          .rounds()
          .where({ choice: RoundChoice.Uncivil }, false)
          .count()
Severity: Minor
Found in packages/server/app/engine/getStatistics.ts and 2 other locations - About 35 mins to fix
packages/server/app/engine/getStatistics.ts on lines 41..46
packages/server/app/engine/getStatistics.ts on lines 113..118

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

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

    pubsub.publish(REGULARIZATION.CREATE, {
      eventTriggered: {
        gameUUID: game.uuid,
        type: EventType.Regularization,
        name
Severity: Minor
Found in packages/server/app/engine/checkRegularization.ts and 2 other locations - About 35 mins to fix
packages/server/app/graphql/resolvers/game.ts on lines 105..111
packages/server/app/graphql/resolvers/player.ts on lines 34..40

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

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

      pubsub.publish(GAME.START, {
        gameUpdated: {
          gameUUID: game.uuid,
          type: GameStatusType.Start,
          players: formattedPlayer
Severity: Minor
Found in packages/server/app/graphql/resolvers/game.ts and 2 other locations - About 35 mins to fix
packages/server/app/engine/checkRegularization.ts on lines 47..53
packages/server/app/graphql/resolvers/player.ts on lines 34..40

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

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 2 locations. Consider refactoring.
Open

    if (reportError?.length > 0) {
      alert.error(error(reportError[0].message))
      set(undefined)
      return
    }
Severity: Minor
Found in packages/mobile/src/pages/Game/Main/Popup/Report/index.tsx and 1 other location - About 35 mins to fix
packages/mobile/src/pages/Game/Main/Popup/Skill/index.tsx on lines 38..42

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

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

Avoid too many return statements within this function.
Open

  else if (player.score > MOST_CIVIL_SCORE) return 'most-civil'
Severity: Major
Found in packages/server/app/engine/getStatistics.ts - About 30 mins to fix

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

    const RoundPlayer: FC<RoundPlayerProps> = props => {
      return (
        <Component>
          {/* <CardStep {...props} /> */}
          {/* <ForwardOrTurn player={player} onSubmit={() => console.log('HELLO')} /> */}
    packages/mobile/src/pages/samples/Game/Round/RoundViewer/index.tsx on lines 16..24

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

    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 2 locations. Consider refactoring.
    Open

    const Viewer: FC<any> = props => {
      return (
        <Component>
          {/* <CardStep choice={CardStepType.Civil} {...props} /> */}
          {/* <PlayerIsPlaying {...props} /> */}
    packages/mobile/src/pages/samples/Game/Round/RoundPlayer/index.tsx on lines 16..24

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

    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

    Avoid too many return statements within this function.
    Open

      return 'moderate'
    Severity: Major
    Found in packages/server/app/engine/getStatistics.ts - About 30 mins to fix

      Function Skill has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      const Skill: FC<PopupProps> = ({ set, player, players }) => {
        const [confirm, setConfirm] = useState<boolean>(false)
        const [skillMutation, skillMutationResponse] = useMutation(USE_SKILL_MUTATION)
        const skillError = skillMutationResponse?.error?.graphQLErrors
        const skillData = skillMutationResponse?.data?.useSkill
      Severity: Minor
      Found in packages/mobile/src/pages/Game/Main/Popup/Skill/index.tsx - About 25 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

      Severity
      Category
      Status
      Source
      Language