Showing 59 of 336 total issues
Function CourseAccessContextProvider
has a Cognitive Complexity of 13 (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 useCart
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const useCart = () => {
const [cart, setCart] = useState<PogressState>({
data: undefined,
loaded: false,
loading: false,
Function useProgress
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const useProgress = () => {
const [progress, setProgress] = useState<PogressState>({
data: undefined,
loaded: false,
loading: false,
Consider simplifying this complex logical expression. Open
if (
(!hasParent &&
statementCategory &&
!statementCategory[0]?.id.includes(questionSet)) ||
(statementCategory &&
Function removeFromCart
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
(itemId: number) => {
if (!token) {
return Promise.reject("noToken");
}
setCart((prevState) => ({
Function readNotify
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
(id: string) => {
return token
? readNotification
.bind(null, apiUrl)(id, token)
.then((response) => {
Function progressMap
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const progressMap = useMemo(() => {
const defaultMap: {
coursesProcProgress: Record<number, number>;
finishedTopics: number[];
} = {
Function changeTermDate
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
apiUrl: string,
termId: number,
newDate: string,
term: string,
token: string,
Function ConsultationAccessContextProvider
has a Cognitive Complexity of 8 (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 subscriptionPayWithP24
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
apiUrl: string,
subId: number,
email: string,
return_url: string,
token: string,
Function approveConsultation
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
apiUrl: string,
token: string,
id: number,
term: string,
userId?: number,
Function questionnaireAnswer
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
apiUrl: string,
token: string,
model: string,
modelID: number,
id: number,
Function CartContextProvider
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
> = ({ children, defaults, apiUrl, ssrHydration }) => {
const abortControllers = useRef<Record<string, AbortController | null>>({});
const { token } = useContext(UserContext);
const [cart, setCart] = useLocalStorage<ContextStateValue<API.Cart>>(
- 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 rejectConsultation
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
apiUrl: string,
token: string,
id: number,
term: string,
userId?: number,
Function sortProgram
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const sortProgram: SortProgram = (lessons) => {
return [...lessons]
.sort((lessonA, lessonB) =>
typeof lessonA.order === "number" && typeof lessonB.order === "number"
? lessonA.order - lessonB.order
- 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 BookmarkNotesContextProvider
has a Cognitive Complexity of 8 (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 updateTask
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
apiUrl: string,
token: string,
id: number,
body: EscolaLms.Tasks.Http.Requests.UpdateTaskRequest,
options?: RequestOptionsInit
Function sendProgress
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
apiUrl: string,
courseId: number,
data: API.CourseProgressItemElement[],
token: string,
options?: RequestOptionsInit
Function getQuestionnaire
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
apiUrl: string,
token: string,
modelTypeTitle: string,
modelID: number,
id: number
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