EscolaLMS/Front

View on GitHub

Showing 585 of 585 total issues

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

const useCamera = () => {
  const [hasCameraAccess, setHasCameraAccess] = useState(false);
  const streamRef = useRef<MediaStream | null>(null);
  const videoRef = useRef<HTMLVideoElement | null>(null);

Severity: Major
Found in src/hooks/meeting/useCamera.ts - 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 MyConsultationsPage has 69 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const MyConsultationsPage = () => {
        const { t } = useTranslation();
        const { isTutor } = useRoles();
      
        const myConsultationsTabs = useMemo(
      Severity: Major
      Found in src/pages/user/my-consultations.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

                      <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 550..557

          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

                          <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 404..416

          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 373..380

          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 680..692

          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

          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">
                          <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

              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

              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

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

              export const CourseMainInfo: FC<CourseMainInfoProps> = ({ courseData }) => {
                const { fetchQuestionnaireStarsByModel } = useContext(EscolaLMSContext);
                const [state, setState] = useState<State>({ type: StateTypes.INIT });
                const history = useHistory();
              
              
              Severity: Minor
              Found in src/pages/courses/course/Components/CourseMainInfo/index.tsx - 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

              Function VerifyEmail has 63 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const VerifyEmail: React.FC = () => {
                const { push } = useHistory();
                const { search } = useLocation();
                const id = search && search?.split("&")[0]?.split("=")[1];
                const hash = search && search?.split("&")[1]?.split("=")[1];
              Severity: Major
              Found in src/pages/verify-email/index.tsx - About 2 hrs to fix

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

                export const IconEyeOff = () => (
                  <svg
                    width="21"
                    height="19"
                    viewBox="0 0 21 19"
                Severity: Major
                Found in src/icons/index.tsx and 1 other location - About 2 hrs to fix
                src/icons/index.tsx on lines 1064..1081

                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 85.

                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

                export const IconEye = () => (
                  <svg
                    width="21"
                    height="15"
                    viewBox="0 0 21 15"
                Severity: Major
                Found in src/icons/index.tsx and 1 other location - About 2 hrs to fix
                src/icons/index.tsx on lines 1083..1100

                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 85.

                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

                Severity
                Category
                Status
                Source
                Language