serge-web/serge-web

View on GitHub

Showing 244 of 805 total issues

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

const buildRoleData = (force: ForceData, role: Role, activityLogs: PlayerLogEntry[], messageLog: PlayerMessageLog): PlayerLogModal => {
  const thisRoleActivities = filterActivitiesByRole(activityLogs, role.roleId)
  const lastActivity = getLastActivity(thisRoleActivities)
  const lastMessage = messageLog[role.roleId]
  const { readIcon } = getMessageReadInfo(lastMessage)
Severity: Minor
Found in client/src/Views/PlayerLog/helpers/playerLogUtils.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

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

export const addTemplatesToChosen = (
  templatesIDs: ParticipantTemplate[] | undefined,
  allTemplatesByKey: TemplateBodysByKey,
  chosenTemplates: TemplateBody[],
  templatesUniqFilter: { [property: string]: boolean }
Severity: Minor
Found in client/src/Helpers/participant-states.ts - 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

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

const componentFor = (
  key: string,
  prop: SelectedProps,
  propertyType: PropertyType,
  value: 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

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

export const getParticipantStates = (
  channel: ChannelTypes, forceId: string | undefined,
  role: Role['roleId'], isObserver: boolean,
  allTemplatesByKey: TemplateBodysByKey,
  // TODO: move it to reducer, for future default Message can be changed from admin
Severity: Minor
Found in client/src/Helpers/participant-states.ts - 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