EscolaLMS/Front

View on GitHub

Showing 559 of 559 total issues

Similar blocks of code found in 7 locations. Consider refactoring.
Open

              <Col lg={12}>
                <Input
                  type="text"
                  name="client_company"
                  label={t("InvoiceData.ClientCompanyName")}
Severity: Major
Found in src/components/Cart/BillingForm/index.tsx and 6 other locations - About 2 hrs to fix
src/components/Cart/BillingForm/index.tsx on lines 77..87
src/components/Cart/BillingForm/index.tsx on lines 100..110
src/components/Cart/BillingForm/index.tsx on lines 111..123
src/components/Cart/BillingForm/index.tsx on lines 124..134
src/components/Cart/BillingForm/index.tsx on lines 135..145
src/components/Cart/BillingForm/index.tsx on lines 146..156

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        <Dropdown
          onChange={(e) => setQuestionnaireId(Number(e.value))}
          options={questionnairesFilter}
          placeholder={t("CoursePage.SelectQuestionnaire")}
          backgroundColor={theme.white}
src/pages/courses/course/Components/CourseRatings/Questionnaires/Dropdowns/index.tsx on lines 57..65

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

          {webinar.value.active_to && (
            <div className="single-label">
              <LabelListItem title={t("WebinarPage.EndDate")} variant={"label"}>
                {webinar.value.active_to
                  ? formatDate(webinar.value.active_to)
Severity: Major
Found in src/components/Webinars/Webinar/WebinarInfo/index.tsx and 2 other locations - About 2 hrs to fix
src/components/Events/Event/EventInfo/index.tsx on lines 77..88
src/components/Webinars/Webinar/WebinarInfo/index.tsx on lines 76..87

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function useSubscriptions has 71 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const useSubscriptions = () => {
  const {
    fetchProducts,
    fetchMyProducts,
    products,
Severity: Major
Found in src/hooks/useSubscriptions.ts - About 2 hrs to fix

    Function StaticPage has 71 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const StaticPage = () => {
      const { slug } = useParams<{ slug: string }>();
      const { fetchPage, page, fetchPages, pages } = useContext(EscolaLMSContext);
    
      const prevSlug = usePrevious(slug);
    Severity: Major
    Found in src/pages/static-page/index.tsx - About 2 hrs to fix

      Function ConsultationsSlider has 70 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const ConsultationsSlider: React.FC<ConsultationsSliderProps> = (props) => {
        const {
          category,
          title = category,
          consultations,
      Severity: Major
      Found in src/components/Consultations/ConsultationsSlider/index.tsx - About 2 hrs to fix

        Function EventRelatedEvents has 69 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const EventRelatedEvents = () => {
          const { stationaryEvents } = useContext(EscolaLMSContext);
          const { t } = useTranslation();
          const data = stationaryEvents.list?.data;
        
        
        Severity: Major
        Found in src/components/Events/Event/EventRelatedEvents/index.tsx - About 2 hrs to fix

          Function Tags has 68 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const Tags = (props: TagsProps) => {
            const { tags, onTagClick } = props;
            const theme = useTheme();
            const [open, setOpen] = useState(false);
            const firstTags = tags ? [...tags].splice(0, 2) : [];
          Severity: Major
          Found in src/components/Tags/index.tsx - About 2 hrs to fix

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                            <button
                              type="button"
                              className="cart-icon"
                              onClick={() => setShowNotifications(!showNotifications)}
                              data-tooltip={String(notifications.list?.meta.total)}
            Severity: Major
            Found in src/components/_App/Navbar/index.tsx and 1 other location - About 2 hrs to fix
            src/components/_App/Navbar/index.tsx on lines 387..399

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 88.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                  <g id="Group_71" data-name="Group 71" transform="translate(0 21.181)">
                    <g id="Group_70" data-name="Group 70" transform="translate(0 0)">
                      <path
                        id="Path_40"
                        data-name="Path 40"
            Severity: Major
            Found in src/icons/index.tsx and 2 other locations - About 2 hrs to fix
            src/icons/index.tsx on lines 636..646
            src/icons/index.tsx on lines 647..657

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 88.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                    <div className="logo-container">
                      <Link to="/" aria-label={t("Go to the main page")}>
                        <ResponsiveImage
                          path={settings?.value?.global?.logo || ""}
                          srcSizes={[50, 100, 150]}
            Severity: Major
            Found in src/components/_App/Navbar/index.tsx and 1 other location - About 2 hrs to fix
            src/components/_App/Navbar/index.tsx on lines 356..363

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 88.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                <g id="Group_32" data-name="Group 32" transform="translate(0 7.285)">
                  <g id="Group_31" data-name="Group 31" transform="translate(0 0)">
                    <rect
                      id="Rectangle_4181"
                      data-name="Rectangle 4181"
            Severity: Major
            Found in src/icons/index.tsx and 2 other locations - About 2 hrs to fix
            src/icons/index.tsx on lines 107..117
            src/icons/index.tsx on lines 636..646

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 88.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                            <button
                              type="button"
                              className="cart-icon"
                              onClick={() => history.push(routeRoutes.myNotifications)}
                              data-tooltip={String(notifications.list?.meta.total)}
            Severity: Major
            Found in src/components/_App/Navbar/index.tsx and 1 other location - About 2 hrs to fix
            src/components/_App/Navbar/index.tsx on lines 648..660

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 88.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                <g id="Group_30" data-name="Group 30" transform="translate(9.675 0)">
                  <g id="Group_29" data-name="Group 29" transform="translate(0 0)">
                    <path
                      id="Path_19"
                      data-name="Path 19"
            Severity: Major
            Found in src/icons/index.tsx and 2 other locations - About 2 hrs to fix
            src/icons/index.tsx on lines 107..117
            src/icons/index.tsx on lines 647..657

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 88.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                        <div className="logo-container">
                          <Link to="/" aria-label={t("Go to the main page")}>
                            <ResponsiveImage
                              path={settings?.value?.global?.logo || ""}
                              srcSizes={[100, 200, 300]}
            Severity: Major
            Found in src/components/_App/Navbar/index.tsx and 1 other location - About 2 hrs to fix
            src/components/_App/Navbar/index.tsx on lines 525..532

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 88.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Function CategoriesBreadCrumbs has 66 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const CategoriesBreadCrumbs = (props: CategoriesProps) => {
              const { categories, onCategoryClick } = props;
              // const [open, setOpen] = useState(false);
              const parentRef = useRef<HTMLDivElement | null>(null);
              const firstCategories = categories || [];
            Severity: Major
            Found in src/components/Categories/CategoriesBreadCrumbs/index.tsx - About 2 hrs to fix

              Function ProfileCertificates has 65 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const ProfileCertificates: React.FC = () => {
                const { certificates, fetchCertificates } = useContext(EscolaLMSContext);
                const { t } = useTranslation();
              
                const { downloadCertificate, loadingId } = useCertificateDownload();
              Severity: Major
              Found in src/components/Profile/ProfileCertificates/index.tsx - About 2 hrs to fix

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                        <Col lg={6}>
                          <div className="input-wrapper">
                            <CardNumberElement options={options} id="cardNumber" />
                            <StyledLabel htmlFor="cardNumber">
                              {t<string>("Card number")}
                Severity: Major
                Found in src/components/Cart/PaymentForm/index.tsx and 1 other location - About 2 hrs to fix
                src/components/Cart/PaymentForm/index.tsx on lines 124..131

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 87.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                        <Col lg={6}>
                          <div className="input-wrapper">
                            <CardExpiryElement options={options} id="cardExpiry" />
                            <StyledLabel htmlFor="cardExpiry">
                              {t<string>("Expiration date")}
                Severity: Major
                Found in src/components/Cart/PaymentForm/index.tsx and 1 other location - About 2 hrs to fix
                src/components/Cart/PaymentForm/index.tsx on lines 114..121

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 87.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Function usePayment has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                const usePayment = () => {
                  const {
                    user,
                    cart,
                    fetchCart,
                Severity: Minor
                Found in src/hooks/usePayment.ts - About 2 hrs to fix

                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

                Severity
                Category
                Status
                Source
                Language