tutorbookapp/tutorbook

View on GitHub

Showing 108 of 518 total issues

Function getMonthsTimeslots has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  baseline: Availability,
  month: number,
  year: number,
  booked?: Availability,
  from: Date = new Date(),
Severity: Minor
Found in lib/utils/time.ts - About 45 mins to fix

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

    export async function getMeetings(
      query: MeetingsQuery
    ): Promise<{ hits: number; results: Meeting[] }> {
      const to = query.to.toISOString();
      const from = query.from.toISOString();
    Severity: Minor
    Found in lib/api/db/meeting.ts - 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 mail has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    export default function mail(subjects: Subject[], description: string, user: User, org: Org, admins: User[]): Promise<void> {
    Severity: Minor
    Found in lib/mail/request.tsx - About 35 mins to fix

      Function getAlgoliaAvailability has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        availability: Availability,
        booked = (new Availability()),
        until = (new Date(new Date().getFullYear(), new Date().getMonth() + 3)),
        interval = 15,
        duration = 60
      Severity: Minor
      Found in lib/utils/time.ts - About 35 mins to fix

        Function getMeeting has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          height: number,
          position: Position,
          meeting: Meeting,
          width: number,
          reference: Date = new Date(0)
        Severity: Minor
        Found in components/calendar/utils.ts - About 35 mins to fix

          Function useSocialProps has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            data: T,
            setData: Callback<T>,
            className: string,
            labelKey: string,
            Model: Constructor<T>
          Severity: Minor
          Found in lib/hooks/social-props.ts - About 35 mins to fix

            Function getTimeslot has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              height: number,
              position: Position,
              original?: Timeslot,
              width: number = WIDTH,
              reference: Date = new Date(0)
            Severity: Minor
            Found in components/availability-select/utils.ts - About 35 mins to fix

              Function getDateWithTime has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                hours: number,
                minutes = 0,
                seconds = 0,
                milliseconds = 0,
                reference = new Date(0)
              Severity: Minor
              Found in lib/utils/time.ts - About 35 mins to fix

                Function createAuthUser has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                export default async function createAuthUser(user: User): Promise<User> {
                  await user.validatePhone();
                  const [err, userRecord] = await to<UserRecord, FirebaseError>(
                    auth.createUser({
                      disabled: false,
                Severity: Minor
                Found in lib/api/create/auth-user.ts - About 35 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 hoursAPI has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                export default async function hoursAPI(
                  req: Req,
                  res: Res<DBHoursCumulative[] | APIError>
                ): Promise<void> {
                  if (req.method !== 'GET') {
                Severity: Minor
                Found in pages/api/users/[id]/hours.ts - About 35 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 UserDisplay has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                export default function UserDisplay({
                  user,
                  langs,
                  subjects,
                }: UserDisplayProps): JSX.Element {
                Severity: Minor
                Found in components/user/display.tsx - About 35 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 loginWithGoogle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                export async function loginWithGoogle(
                  user?: User,
                  gsuite?: boolean
                ): Promise<User> {
                  const { default: firebase } = await import('lib/firebase');
                Severity: Minor
                Found in lib/firebase/login.ts - About 35 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 deleteMeetingAPI has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                export default async function deleteMeetingAPI(
                  req: Req,
                  res: Res<DeleteMeetingRes>
                ): Promise<void> {
                  try {
                Severity: Minor
                Found in lib/api/routes/meetings/delete.tsx - About 35 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 RequestForm has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                export default function RequestForm(): JSX.Element {
                  const { org } = useOrg();
                  const { t } = useTranslation();
                  const [user, setUser] = useState<User>(new User());
                  const [subjects, setSubjects] = useState<Subject[]>([]);
                Severity: Minor
                Found in components/request.tsx - About 35 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

                Avoid too many return statements within this function.
                Open

                  if (!isAvailabilityJSON(json.availability)) 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 (subjects) return subjects;
                  Severity: Major
                  Found in components/calendar/meetings/content.tsx - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                      return true;
                    Severity: Major
                    Found in lib/model/user.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                        if (!isBookingConfig(json.booking)) 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 (!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 (!isArray(json.subjects, isSubject)) return false;
                          Severity: Major
                          Found in lib/model/user.ts - About 30 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language