tutorbookapp/tutorbook

View on GitHub

Showing 108 of 518 total issues

Function isMeetingJSON has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export function isMeetingJSON(json: unknown): json is MeetingJSON {
  if (!isResourceJSON(json)) return false;
  if (!isJSON(json)) return false;
  if (typeof json.id !== 'number') return false;
  if (!isArray(json.tags, isMeetingTag)) return false;
Severity: Minor
Found in lib/model/meeting.ts - About 1 hr 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 SubjectSelect has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

function SubjectSelect({
  value,
  onChange,
  selected,
  onSelectedChange,
Severity: Minor
Found in components/subject-select/index.tsx - About 1 hr 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 updateAccount has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

async function updateAccount(req: Req, res: Res): Promise<void> {
  const body = verifyBody<User, UserJSON>(req.body, isUserJSON, User);

  // Revert to old behavior if user doesn't already exist; just create it.
  const original = (await to(getUser(body.id)))[1];
Severity: Minor
Found in pages/api/account/index.ts - About 1 hr 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 useClickOutside has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export default function useClickOutside(
  onClickOutside: () => void,
  active: boolean
): ClickOutsideProps {
  const clickableEls = useRef<Record<string, HTMLElement>>({});
Severity: Minor
Found in lib/hooks/click-outside.ts - About 1 hr 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 WeeklyDisplay has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

function WeeklyDisplay({
  searching,
  meetings,
  filtersOpen,
  width: cellWidth,
Severity: Minor
Found in components/calendar/weekly-display.tsx - About 1 hr 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 useContinuous has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export default function useContinuous<T>(
  fallbackData: T,
  updateRemote: (data: T) => Promise<T | void>,
  updateLocal?: (data: T, hasBeenUpdated?: boolean) => Promise<void> | void
): ContinuousProps<T> {
Severity: Minor
Found in lib/hooks/continuous.ts - About 1 hr 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 verifyAuth has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export default async function verifyAuth(
  headers: IncomingHttpHeaders,
  options?: { userId?: string; userIds?: string[]; orgIds?: string[] }
): Promise<{ adminOf?: string[]; uid: string }> {
  if (typeof headers.cookie !== 'string')
Severity: Minor
Found in lib/api/verify/auth.ts - About 1 hr 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 isOrgJSON has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export function isOrgJSON(json: unknown): json is OrgJSON {
  if (!isAccountJSON(json)) return false;
  if (!isJSON(json)) return false;
  if (!isStringArray(json.members)) return false;
  if (!isStringArray(json.domains)) return false;
Severity: Minor
Found in lib/model/org.ts - About 1 hr 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 getUsers has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export async function getUsers(
  query: UsersQuery
): Promise<{ hits: number; results: User[] }> {
  // TODO: Order by multiple attributes to show featured results first.
  let select = query.met
Severity: Minor
Found in lib/api/db/user.ts - About 1 hr 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 MeetingRnd has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export default function MeetingRnd({
  now,
  width,
  eventTarget,
  eventData,
Severity: Minor
Found in components/calendar/meetings/rnd.tsx - About 1 hr 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 updateMeetingAPI has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export default async function updateMeetingAPI(
  req: Req,
  res: Res<UpdateMeetingRes>
): Promise<void> {
  try {
Severity: Minor
Found in lib/api/routes/meetings/update.tsx - About 1 hr 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 CalendarHeader has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function CalendarHeader({ query, setQuery }: CalendarHeaderProps): JSX.Element {
  const { org } = useOrg();
  const { t, lang: locale } = useTranslation();

  const title = useMemo(() => {
Severity: Minor
Found in components/calendar/header.tsx - About 1 hr 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 AuthDialog has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export default function AuthDialog(): JSX.Element {
  const [loggingIn, setLoggingIn] = useState<boolean>(false);
  const [error, setError] = useState<string>('');

  const { org } = useOrg();
Severity: Minor
Found in components/auth-dialog/index.tsx - About 1 hr 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 isTimeslotJSON has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export function isTimeslotJSON(json: unknown): json is TimeslotJSON {
  if (!isJSON(json)) return false;
  if (typeof json.id !== 'string') return false;
  if (!isDateJSON(json.from)) return false;
  if (!isDateJSON(json.to)) return false;
Severity: Minor
Found in lib/model/timeslot.ts - About 55 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 Login has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export default function Login(): JSX.Element {
  const { query } = useRouter();
  const { t } = useTranslation();

  const [error, setError] = useState<string>('');
Severity: Minor
Found in components/login/index.tsx - About 55 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 UserSelect has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export default function UserSelect({
  query,
  value,
  onChange,
  selected,
Severity: Minor
Found in components/user-select/index.tsx - About 55 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 getDate has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  weekday: number,
  hours: number,
  minutes = 0,
  seconds = 0,
  milliseconds = 0,
Severity: Minor
Found in lib/utils/time.ts - About 45 mins to fix

    Function Home has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function Home({ org }: HomeProps): JSX.Element {
      const { t, lang: locale } = useTranslation();
    
      return (
        <div data-cy='org-home' className={cn({ [styles.loading]: !org })}>
    Severity: Minor
    Found in components/home/index.tsx - About 45 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 SearchPage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    function SearchPage(props: PageProps): JSX.Element {
      usePage('Search');
    
      const { t } = useTranslation();
    
    
    Severity: Minor
    Found in pages/search.tsx - About 45 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 MeetingItem has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function MeetingItem({
      now,
      meeting,
      leftPercent,
      widthPercent,
    Severity: Minor
    Found in components/calendar/meetings/item.tsx - About 45 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