Showing 162 of 559 total issues
Function topicRender
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
const topicRender = useMemo(() => {
if (topic && topic.topicable_type) {
switch (topic.topicable_type) {
case TopicType.H5P:
// @ts-ignore
Function MyWebinarsPage
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
const MyWebinarsPage = () => {
const { userWebinars, fetchUserWebinars } = useContext(EscolaLMSContext);
const { t } = useTranslation();
useEffect(() => {
Function OrdersSkeleton
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
const OrdersSkeleton = () => {
const id = useId();
return (
<>
<div>
Function useProfileCourses
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
const useProfileCourses = (filter = CourseStatus.ALL) => {
const {
fetchMyAuthoredCourses,
myAuthoredCourses,
fetchPaginatedProgress,
- 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 useChatLogic
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
const useChatLogic = (lessonID: number, token: string | null | undefined) => {
if (!token) throw new Error("Token is required");
const [chatState, setChatState] = useState<State>(INITIAL_STATE);
const { t } = useTranslation();
- 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 useNotifications
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const useNotifications = () => {
const [list, setList] = useState<Notification[]>([]);
const {
fetchNotifications,
notifications,
Function ButtonsNav
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const ButtonsNav = () => {
const {
completeCurrentTopic,
currentTopic,
finishedTopicsIds,
File index.tsx
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, {
useCallback,
useContext,
useEffect,
useMemo,
Function Login
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Login = () => {
const { search, state } = useLocation<{ referrer?: string }>();
const { user, socialAuthorize } = useContext(EscolaLMSContext);
const [view, setView] = useState<
"login" | "forgotPassword" | "register" | "success"
Function EmailActivation
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
const EmailActivation = () => {
const { config } = useContext(EscolaLMSContext);
const accountActivationByAdmin =
config?.value?.escola_auth?.account_must_be_enabled_by_admin ===
Function MyProfile
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
const MyProfile = () => {
const { t } = useTranslation();
const { isTutor } = useRoles();
const { query, setQueryParam } = useSearchParams();
Function PackageSidebar
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const PackageSidebar = () => {
const { product } = useContext(EscolaLMSContext);
const { t } = useTranslation();
const productValue = product.value;
Function ThemeCustomizer
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const ThemeCustomizer = (theme: Record<string, DefaultTheme>) => {
const [, setTheme] = useLocalTheme({
...defaultTheme,
theme: "contrastTheme",
});
Function ConsultationsHeaderFilters
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ConsultationsHeaderFilters = () => {
const {
setPathname,
setQueryParam,
setQueryArrayParam,
Function useCourseProgress
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const useCourseProgress = (courseId: number) => {
const [progress, setProgress] = useState<PogressState>({
data: undefined,
loaded: false,
loading: false,
Function EventDetailsSidebar
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
const EventDetailsSidebar: React.FC<{ event: API.StationaryEvent }> = ({
event,
}) => {
const [buttonStatus, setButtonStatus] = useState<ButtonStatus>(
ButtonStatus.DEFAULT
- 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 WebinarsContainerItems
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
const WebinarsContainerItems = () => {
const { params, setParams, webinars } = useContext(WebinarsContext);
const loading = webinars?.loading;
const meta = webinars?.list?.meta;
const theme = useTheme();
Function EventsContainerItems
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
const EventsContainerItems = () => {
const { params, setParams, events } = useContext(EventsContext);
const eventLoading = events?.loading;
const eventsMeta = events?.list?.meta;
const theme = useTheme();
Function PackagesContainerItems
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
const PackagesContainerItems = () => {
const { params, setParams, packages } = useContext(PackagesContext);
const packagesLoading = packages?.loading;
const packagesMeta = packages?.list?.meta;
const theme = useTheme();
Function useFirebase
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const useFirebase = () => {
const { token } = useContext(EscolaLMSContext);
const requestPermissions = async () => {
const result = await FirebaseMessaging.requestPermissions();