tutorbookapp/tutorbook

View on GitHub

Showing 108 of 518 total issues

Avoid too many return statements within this function.
Open

  if (!isArray(json.subjects, isSubject)) return false;
Severity: Major
Found in lib/model/user.ts - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

      if (typeof json.visible !== 'boolean') return false;
    Severity: Major
    Found in lib/model/user.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

        if (!isArray(json.subjects, isSubject)) return false;
      Severity: Major
      Found in lib/model/meeting.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                if (student?.name) return student.name;
        Severity: Major
        Found in components/calendar/meetings/content.tsx - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

            if (!isArray(json.meetings, isMeetingJSON)) return false;
          Severity: Major
          Found in lib/model/user.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

              if (json.hash && typeof json.hash !== 'string') return false;
            Severity: Major
            Found in lib/model/user.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                if (!isArray(json.roles, isRole)) return false;
              Severity: Major
              Found in lib/model/user.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                  if (!isArray(json.tags, isUserTag)) return false;
                Severity: Major
                Found in lib/model/user.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                    if (typeof json.reference !== 'string') return false;
                  Severity: Major
                  Found in lib/model/user.ts - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                      if (!isSignupConfig(json.signup)) return false;
                    Severity: Major
                    Found in lib/model/org.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                        if (typeof json.description !== 'string') return false;
                      Severity: Major
                      Found in lib/model/meeting.ts - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                          if (!isStringArray(json.langs)) return false;
                        Severity: Major
                        Found in lib/model/user.ts - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                            if (json.recur && typeof json.recur !== 'string') return false;
                          Severity: Major
                          Found in lib/model/timeslot.ts - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                              if (json.exdates && !isArray(json.exdates, isDateJSON)) return false;
                            Severity: Major
                            Found in lib/model/timeslot.ts - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                    return avail;
                              Severity: Major
                              Found in components/availability-select/index.tsx - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                  if (typeof json.timezone !== 'string') return false;
                                Severity: Major
                                Found in lib/model/user.ts - About 30 mins to fix

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

                                  function UserDisplayPage({
                                    org,
                                    user: fallbackData,
                                    langs: initialLangs,
                                    subjects: initialSubjects,
                                  Severity: Minor
                                  Found in pages/[org]/users/[id]/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 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 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