Showing 59 of 336 total issues
File index.tsx
has 1831 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, {
FunctionComponent,
useCallback,
useState,
useEffect,
File api.ts
has 1723 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { API } from "..";
type Nullable<T> = T | null | undefined;
export enum TopicType {
Function EscolaLMSContextProviderInner
has a Cognitive Complexity of 125 (exceeds 5 allowed). Consider refactoring. Open
> = ({
children,
apiUrl,
defaults,
imagePrefix = `${apiUrl}/storage/imgcache`,
- Read upRead up
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
defaultApiConfig
has 129 functions (exceeds 20 allowed). Consider refactoring. Open
export const defaultApiConfig: EscolaLMSContextConfig = {
apiUrl: "",
myCourses: {
loading: false,
value: [],
defaultReadConfig
has 129 functions (exceeds 20 allowed). Consider refactoring. Open
export const defaultReadConfig: EscolaLMSContextConfig = {
apiUrl: "",
getImagePrefix: () => "",
getImageSvgPrefix: () => "",
File defaults.ts
has 828 lines of code (exceeds 250 allowed). Consider refactoring. Open
import * as API from "./../../types/api";
import { EscolaLMSContextConfig } from "./types";
export const blackList: API.IEvent[] = [
File types.ts
has 575 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { RequestOptionsInit } from "umi-request";
import * as API from "./../../types/api";
export interface ContextState<T> {
loading: boolean;
Function fetchDataType
has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring. Open
export async function fetchDataType<T>(params: fetchDataType<T>) {
const { setState, fetchAction, mode, controller, controllers, onError } =
params;
if (mode === "paginated") {
- Read upRead up
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 fetchDataType
has 157 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function fetchDataType<T>(params: fetchDataType<T>) {
const { setState, fetchAction, mode, controller, controllers, onError } =
params;
if (mode === "paginated") {
File user.tsx
has 402 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {
createContext,
FunctionComponent,
PropsWithChildren,
useCallback,
Function UserContextProvider
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
> = ({ children, defaults, apiUrl, ssrHydration }) => {
const abortControllers = useRef<Record<string, AbortController | null>>({});
useEffect(() => {
if (defaults) {
- Read upRead up
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 h5pProgress
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
(courseId: string, topicId: number, statement: API.IStatement) => {
const statementId = statement?.verb?.id;
const statementCategory = statement?.context?.contextActivities?.category;
const result: API.IResult | undefined = statement?.result;
const hasParent =
Function NotificationsContextProvider
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
> = ({ children, defaults, apiUrl, ssrHydration }) => {
const abortControllers = useRef<Record<string, AbortController | null>>({});
const { token } = useContext(UserContext);
- Read upRead up
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 fetchProgram
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
(id: number) => {
setProgram((prevState) => ({
...prevState,
loading: true,
byId: prevState.byId
Function fetchCourse
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
(id: number) => {
setCourse((prevState) => ({
...prevState,
loading: true,
byId: prevState.byId
Function fetchCourseProgress
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
(id: number) => {
if (!token) {
return Promise.reject("noToken");
}
setCourseProgressDetails((prevState) => ({
Function sendProgress
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
(courseId: number, data: API.CourseProgressItemElement[]) => {
return token
? postSendProgress
.bind(null, apiUrl)(courseId, data, token)
.then((res) => {
Function Image
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
(
{ path, size, srcSizes, alt = "LMS Image", format = "webp", ...props },
imgRef
) => {
const [cached, setCached] = useState(false);
- Read upRead up
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 TaskContextProvider
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
> = ({ children, defaults, apiUrl, ssrHydration }) => {
const { token } = useContext(UserContext);
const abortControllers = useRef<Record<string, AbortController | null>>({});
- Read upRead up
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 readAllNotifications
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
const readAllNotifications = useCallback(() => {
return token
? postReadAll
.bind(
null,