EscolaLMS/sdk

View on GitHub

Showing 56 of 334 total issues

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

  apiUrl: string,
  productableId: number,
  productableType: string,
  token?: string | null,
  options?: RequestOptionsInit
Severity: Minor
Found in src/services/products.ts - About 35 mins to fix

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

      apiUrl: string,
      termId: number,
      newDate: string,
      token: string,
      options?: RequestOptionsInit
    Severity: Minor
    Found in src/services/consultations.ts - About 35 mins to fix

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

        apiUrl: string,
        courseId: number,
        data: API.CourseProgressItemElement[],
        token: string,
        options?: RequestOptionsInit
      Severity: Minor
      Found in src/services/courses.ts - About 35 mins to fix

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

          apiUrl: string,
          topicId: number,
          statementId: string,
          statement: API.IStatement,
          token: string
        Severity: Minor
        Found in src/services/courses.ts - About 35 mins to fix

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

            apiUrl: string,
            token: string,
            id: number,
            term: string,
            options?: RequestOptionsInit
          Severity: Minor
          Found in src/services/consultations.ts - About 35 mins to fix

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

              apiUrl: string,
              token: string,
              id: number,
              body: EscolaLms.Tasks.Http.Requests.UpdateTaskRequest,
              options?: RequestOptionsInit
            Severity: Minor
            Found in src/services/task_notes.ts - About 35 mins to fix

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

                apiUrl: string,
                token: string,
                id: number,
                body: API.CreateBookmarkNote,
                options?: RequestOptionsInit
              Severity: Minor
              Found in src/services/bookmarks_notes.ts - About 35 mins to fix

                Avoid too many return statements within this function.
                Open

                  return undefined;
                Severity: Major
                Found in src/react/context/states.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return;
                  Severity: Major
                  Found in src/react/context/states.ts - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return response;
                    Severity: Major
                    Found in src/react/context/states.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return error;
                      Severity: Major
                      Found in src/react/context/states.ts - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                  return response;
                        Severity: Major
                        Found in src/react/context/states.ts - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                return error;
                          Severity: Major
                          Found in src/react/context/states.ts - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                  return null;
                            Severity: Major
                            Found in src/react/context/index.tsx - About 30 mins to fix

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

                              export function useLocalStorage<T>(
                                storeKey: string,
                                key: string,
                                initialValue: T,
                                ssrHydration: boolean = false
                              Severity: Minor
                              Found in src/react/hooks/useLocalStorage.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 TasksContextProvider has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                              > = ({ children, defaults, apiUrl, ssrHydration }) => {
                                const abortControllers = useRef<Record<string, AbortController | null>>({});
                              
                                const { token } = useContext(UserContext);
                              
                              
                              Severity: Minor
                              Found in src/react/context/tasks.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