Enterprise-CMCS/macpro-mako

View on GitHub

Showing 124 of 140 total issues

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

export const getFormOrigin: GetFormOrigin = ({ id, authority } = {}) => {
  const origin =
    new URLSearchParams(window.location.search).get(ORIGIN) ?? DASHBOARD_ORIGIN;

  if (origin === DETAILS_ORIGIN && id && authority) {
Severity: Minor
Found in react-app/src/utils/formOrigin.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 transform has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const transform = (id: string) => {
  return legacyEventSchema.transform((data) => {
    // Resolve the action type based on the GSI1pk
    const eventType = data?.GSI1pk?.split("OneMAC#submit")?.[1] || "";

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 getAttachments has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const getAttachments = <Schema extends z.ZodTypeAny>(
  schema: Schema,
): [string, z.ZodObject<z.ZodRawShape, "strip">][] => {
  if (schema instanceof z.ZodEffects) {
    return getAttachments(schema.innerType());
Severity: Minor
Found in react-app/src/components/ActionForm/actionForm.utilities.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 DownloadAllButton has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const DownloadAllButton = ({ packageId, submissionChangelog }: DownloadAllButtonProps) => {
  const { onZip, loading } = useAttachmentService({ packageId });

  if (submissionChangelog?.length === 0) {
    return null;
Severity: Minor
Found in react-app/src/features/package/package-activity/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