tutorbookapp/tutorbook

View on GitHub

Showing 108 of 518 total issues

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

function ResultsList({
  query,
  searching,
  setSearching,
  setHits,
Severity: Minor
Found in components/users/results-list.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 getPerson has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export default async function getPerson(
  { id, roles, name }: Partial<User> & { id: string },
  people: User[] = []
): Promise<User> {
  if (!id) {
Severity: Minor
Found in lib/api/get/person.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 DialogContent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export default function DialogContent({
  page,
  children,
  forceMinHeight,
}: DialogContentProps): JSX.Element {
Severity: Minor
Found in components/dialog/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

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

export default async function remind(req: Req, res: Res): Promise<void> {
  if (req.method !== 'GET') {
    res.setHeader('Allow', ['GET']);
    res.status(405).end(`Method ${req.method as string} Not Allowed`);
  } else {
Severity: Minor
Found in pages/api/remind.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 getMeetingVenue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export default function getMeetingVenue(
  meeting: Meeting,
  org: Org,
  people: User[]
): string {
Severity: Minor
Found in lib/api/get/meeting-venue.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 sendLoginLink has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

async function sendLoginLink(req: Req, res: Res<void>): Promise<void> {
  if (!isJSON(req.body)) throw new APIError('Invalid request body', 400);
  if (typeof req.body.email !== 'string')
    throw new APIError('Request body must contain an email', 400);
  if (typeof req.body.location !== 'string')
Severity: Minor
Found in pages/api/login.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 Card has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function Card<T extends Record<string, number> & { week: number }>({
  data,
  title,
  children,
  header,
Severity: Minor
Found in components/analytics/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

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

export default function UserEdit({
  user: fallbackData,
}: UserEditProps): JSX.Element {
  const updateLocal = useCallback(async (updated: User) => {
    await mutate(`/api/users/${updated.id}`, updated.toJSON(), false);
Severity: Minor
Found in components/user/edit.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