Showing 162 of 559 total issues
Function CourseProgram
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
const CourseProgram = () => {
const { t } = useTranslation();
const { id } = useParams<{ id: string }>();
const { program, fetchProgram } = useContext(EscolaLMSContext);
Function SubscriptionBox
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const SubscriptionBox: React.FC<Props> = ({ subscription }) => {
const { t } = useTranslation();
const { buySubscriptionByP24, user } = usePayment();
const history = useHistory();
- 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 ProposedTermsContent
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const ProposedTermsContent = ({ consultation, onClose }: Props) => {
const [selectedDate, setSelectedDay] = useState<Date | null>(null);
const [selectedTime, setSelectedTime] = useState<Date | null>(null);
const [loading, setLoading] = useState(false);
const [step, setStep] = useState(1);
- 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 CourseAccessButton
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const CourseAccessButton: React.FC<CourseAccessButtonProps> = ({
course,
onRequestAccess,
setModalVisible,
}) => {
- 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 WebinarSidebar
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
const WebinarSidebar = () => {
const {
webinar: { value: webinarObject },
} = useContext(EscolaLMSContext);
const { t } = useTranslation();
Function MyStationaryEvents
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
const MyStationaryEvents = () => {
const { fetchUserStationaryEvents } = useContext(EscolaLMSContext);
const { t } = useTranslation();
useEffect(() => {
fetchUserStationaryEvents();
Function SubscriptionsPage
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
const SubscriptionsPage = () => {
const { t } = useTranslation();
const {
subscriptions,
isLoading,
Function CourseSchedule
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const CourseSchedule = () => {
const { t } = useTranslation();
const { user } = useContext(EscolaLMSContext);
const {
currentTopic,
Function ConsultationsContainerItems
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ConsultationsContainerItems = () => {
const { consultations } = useContext(ConsultationsContext);
const { setQueryParam } = useSearchParams();
const ConsultationsLoading = consultations?.loading;
const consultationsMeta = consultations?.list?.meta;
Function useCart
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const useCart = () => {
const [cart, setCart] = useState<PogressState>({
data: undefined,
loaded: false,
loading: false,
Function availableTopicsIds
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
const availableTopicsIds = useMemo(() => {
const activeLessons = (currentCourseProgram?.lessons ?? []).filter(
(l) =>
l.active_from === null ||
(l.active_from && isAfter(new Date(), new Date(l.active_from)))
Function availableTopicsIds
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
const availableTopicsIds = useMemo(() => {
const activeLessons = (currentCourseProgram?.lessons ?? []).filter(
(l) =>
l.active_from === null ||
(l.active_from && isAfter(new Date(), new Date(l.active_from)))
Function Buttons
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Buttons = useMemo(() => {
if (userId && product.owned) {
return <Text size="12">{t("PackagePage.ProductOwned")}</Text>;
}
if (productInCart) {
Function RateCourse
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const RateCourse: React.FC<Props> = ({
course,
courseId,
visible,
questionnaire,
- 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 PackageSidebarButtons
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export const PackageSidebarButtons = ({ product }: Props) => {
const { cart, addToCart, user } = useContext(EscolaLMSContext);
const { t } = useTranslation();
const { push } = useHistory();
const userId = user.value?.id;
- 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 fetchPageNumbers
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
const fetchPageNumbers = () => {
/**
* totalNumbers: the total page numbers to show on the control
* totalBlocks: totalNumbers + 2 to cover for the left(<) and right(>) controls
*/
Function EventTutor
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
const EventTutor = () => {
const { stationaryEvent } = useContext(EscolaLMSContext);
const { t } = useTranslation();
const authors = stationaryEvent.value?.product?.authors;
Function ConsultationsProvider
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ConsultationsProvider: React.FC<PropsWithChildren> = (props) => {
const { fetchConsultations, consultations, fetchCategories } =
useContext(EscolaLMSContext);
const { children } = props;
const { query, getQueryValueByName, getAllQueryValueByName, setPathname } =
Function handleSendAnswer
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
async (rate: number, note?: string) => {
if (questionnaire.questions) {
setState((prevState) => ({
...prevState,
loading: true,
Function GoTop
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
const GoTop = () => {
const [isVisible, setIsVisible] = useState(false);
useEffect(() => {
document.addEventListener("scroll", () => {