Showing 162 of 559 total issues
Function Sidebar
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Sidebar = () => {
const { t } = useTranslation();
const { settings, courses, fetchCourses } = useContext(EscolaLMSContext);
useEffect(() => {
Consider simplifying this complex logical expression. Open
if (
slug &&
!page.loading &&
((!page.value && !page.error) ||
(page.value && page.value?.slug !== slug) ||
Function PackageSidebarTags
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const PackageSidebarTags = () => {
const { product } = useContext(EscolaLMSContext);
const grouped = useMemo(
() => groupProductablesByType(product?.value?.productables || []),
[product?.value?.productables]
Function App
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
const App = () => {
const { fetchSettings, settings, fetchNotifications, fetchConfig } =
useContext(EscolaLMSContext);
useEffect(() => {
Function handleSubmit
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
const handleSubmit = (): void => {
if (!billingDetails.name) {
toast(`${t("Cart.EmptyNameWarning")}`, "error");
return;
}
Function CartPage
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
const CartPage: React.FC<Props> = () => {
const { config } = useContext(EscolaLMSContext);
const stripePromise = (publishable_key: string) =>
loadStripe(publishable_key);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Function MySubscriptions
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
const MySubscriptions = () => {
const { t } = useTranslation();
const {
subscriptions,
getActiveSubscription,
Function useSubscriptions
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const useSubscriptions = () => {
const {
fetchProducts,
fetchMyProducts,
products,
- 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 CourseDetailsSidebarButtons
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const CourseDetailsSidebarButtons: React.FC<Props> = ({
course,
userOwnThisCourse,
onRequestAccess,
}) => {
- 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 TutorPage
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const TutorPage = () => {
const { id } = useParams<{ id: string }>();
const { t } = useTranslation();
const { tutor, fetchTutor, courses, fetchCourses } =
useContext(EscolaLMSContext);
- 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 RegisterPage
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const RegisterPage = () => {
const { search } = useLocation();
const { user, socialAuthorize } = useContext(EscolaLMSContext);
const [view, setView] = useState<"" | "success" | "register">("");
const [modalVisible, setModalVisible] = 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 StaticPage
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const StaticPage = () => {
const { slug } = useParams<{ slug: string }>();
const { fetchPage, page, fetchPages, pages } = useContext(EscolaLMSContext);
const prevSlug = usePrevious(slug);
- 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 renderProperOptions
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
(option: OnboardingOption) => {
switch (step.type) {
case OnboardingStepType.radio:
return (
<Radio
Function useDeleteAccountModal
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
const useDeleteAccountModal = () => {
const [loading, setLoading] = useState(false);
const [showModal, setShowModal] = useState(false);
const { deleteAccount, logout } = useContext(EscolaLMSContext);
const history = useHistory();
Function ResetPassword
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ResetPassword: React.FC = () => {
const { push } = useHistory();
const { search } = useLocation();
const email = search && search.split("&")[0].split("=")[1];
const token = search && search.split("&")[1].split("=")[1];
Function CoursePageContentSkeleton
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
const CoursePageContentSkeleton = () => {
return (
<SkeletonWrapper>
<Skeleton width={"20px"} style={{ marginBottom: "5px" }} />
<Skeleton width={"40%"} height={37} style={{ marginBottom: "10px" }} />
Function handleFetchQuestionnairesAnswers
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
(page: number) => {
if (questionId && courseId) {
setLoading(true);
fetchQuestionnairesAnswers(
QuestionnaireModelType.COURSE,
Function getFormattedDifferenceRelativeToNow
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const getFormattedDifferenceRelativeToNow = (time: Date) => {
const daysDifference = time
? differenceInDays(time.getTime(), new Date().getTime())
: null;
const hoursDifference = time
Function CartSuccess
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
const CartSuccess = () => {
const { t } = useTranslation();
const { fetchProgress } = useContext(EscolaLMSContext);
Function ConsultationHero
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ConsultationHero: React.FC<ConsultationHeroProps> = (props) => {
const { consultation } = props;
return (
<Row align={"center"}>