EscolaLMS/Front

View on GitHub

Showing 585 of 585 total issues

Function CourseDetailsSidebarButtons has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

const CourseDetailsSidebarButtons: React.FC<Props> = ({
  course,
  userOwnThisCourse,
  onRequestAccess,
}) => {

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);
Severity: Minor
Found in src/pages/register/index.tsx - About 1 hr 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 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);
Severity: Minor
Found in src/pages/static-page/index.tsx - About 1 hr 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

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

      <div style={{ marginBottom: "40px" }}>
        <Skeleton width={"100%"} count={4} style={{ marginBottom: "5px" }} />
      </div>
Severity: Major
Found in src/components/Skeletons/CoursePage/content.tsx and 4 other locations - About 1 hr to fix
src/components/Skeletons/Consultation/index.tsx on lines 21..23
src/components/Skeletons/Consultation/index.tsx on lines 24..26
src/components/Skeletons/Consultation/index.tsx on lines 27..29
src/components/Skeletons/CoursePage/content.tsx on lines 23..25

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

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 5 locations. Consider refactoring.
Open

      <div style={{ marginBottom: "40px" }}>
        <Skeleton width={"100%"} count={5} style={{ marginBottom: "5px" }} />
      </div>{" "}
Severity: Major
Found in src/components/Skeletons/Consultation/index.tsx and 4 other locations - About 1 hr to fix
src/components/Skeletons/Consultation/index.tsx on lines 21..23
src/components/Skeletons/Consultation/index.tsx on lines 24..26
src/components/Skeletons/CoursePage/content.tsx on lines 20..22
src/components/Skeletons/CoursePage/content.tsx on lines 23..25

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

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 5 locations. Consider refactoring.
Open

      <div style={{ marginBottom: "40px" }}>
        <Skeleton width={"100%"} count={5} style={{ marginBottom: "5px" }} />
      </div>{" "}
Severity: Major
Found in src/components/Skeletons/Consultation/index.tsx and 4 other locations - About 1 hr to fix
src/components/Skeletons/Consultation/index.tsx on lines 21..23
src/components/Skeletons/Consultation/index.tsx on lines 27..29
src/components/Skeletons/CoursePage/content.tsx on lines 20..22
src/components/Skeletons/CoursePage/content.tsx on lines 23..25

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

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 5 locations. Consider refactoring.
Open

      <div style={{ marginBottom: "40px" }}>
        <Skeleton width={"100%"} count={4} style={{ marginBottom: "5px" }} />
      </div>
Severity: Major
Found in src/components/Skeletons/Consultation/index.tsx and 4 other locations - About 1 hr to fix
src/components/Skeletons/Consultation/index.tsx on lines 24..26
src/components/Skeletons/Consultation/index.tsx on lines 27..29
src/components/Skeletons/CoursePage/content.tsx on lines 20..22
src/components/Skeletons/CoursePage/content.tsx on lines 23..25

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

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

  <svg
    xmlns="http://www.w3.org/2000/svg"
    width={width}
    height={height}
    viewBox={`0 0 ${width} ${height}`}
Severity: Major
Found in src/icons/index.tsx and 1 other location - About 1 hr to fix
src/icons/index.tsx on lines 502..517

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

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 5 locations. Consider refactoring.
Open

      <div style={{ marginBottom: "40px" }}>
        <Skeleton width={"100%"} count={5} style={{ marginBottom: "5px" }} />
      </div>
Severity: Major
Found in src/components/Skeletons/CoursePage/content.tsx and 4 other locations - About 1 hr to fix
src/components/Skeletons/Consultation/index.tsx on lines 21..23
src/components/Skeletons/Consultation/index.tsx on lines 24..26
src/components/Skeletons/Consultation/index.tsx on lines 27..29
src/components/Skeletons/CoursePage/content.tsx on lines 20..22

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

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

    <svg
      xmlns="http://www.w3.org/2000/svg"
      width="5.921"
      height="10.387"
      viewBox="0 0 5.921 10.387"
Severity: Major
Found in src/icons/index.tsx and 1 other location - About 1 hr to fix
src/icons/index.tsx on lines 1183..1198

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

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

                          tags={
                            <Tags
                              tags={item.tags as Tag[]}
                              onTagClick={(tagName) =>
                                history.push(`/courses/?tag=${tagName}`)
Severity: Major
Found in src/pages/tutors/tutor/index.tsx and 1 other location - About 1 hr to fix
src/components/Webinars/List/WebinarsContainer/Items/Item/index.tsx on lines 58..63

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

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

      {oldPrice && (
        <div className="pricing-card-discount">
          <Text size={textSizes?.old || "18"}>
            {formatPrice(oldPrice, taxRate)} zł
          </Text>
Severity: Major
Found in src/components/ProductPrices/index.tsx and 1 other location - About 1 hr to fix
src/components/ProductPrices/index.tsx on lines 40..46

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

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

      tags={
        <Tags
          tags={webinar.tags as Tag[]}
          onTagClick={(tagName) => history.push(`/webinars/?tags[]=${tagName}`)}
        />
src/pages/tutors/tutor/index.tsx on lines 140..147

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

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

        {oldPrice && (
          <div className="pricing-card-discount">
            <Text size={textSizes?.old || "18"}>
              {formatPrice(oldPrice, taxRate)} zł
            </Text>
Severity: Major
Found in src/components/ProductPrices/index.tsx and 1 other location - About 1 hr to fix
src/components/ProductPrices/index.tsx on lines 58..64

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

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 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();
Severity: Minor
Found in src/hooks/useDeleteAccount.ts - About 1 hr to fix

    Function ConsultationsProvider has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const ConsultationsProvider: React.FC<PropsWithChildren> = (props) => {
      const { children } = props;
      const [params, setParams] = useState<API.CourseParams>({
        page: 1,
        per_page: COURSES_ON_PAGE,
    Severity: Minor
    Found in src/components/Consultations/List/ConsultationsProvider.tsx - About 1 hr to fix

      Function renderProperOptions has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          (option: OnboardingOption) => {
            switch (step.type) {
              case OnboardingStepType.radio:
                return (
                  <Radio
      Severity: Minor
      Found in src/components/Onboarding/Step/index.tsx - About 1 hr to fix

        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];
        Severity: Minor
        Found in src/pages/reset-password/index.tsx - About 1 hr to fix

          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" }} />
          Severity: Minor
          Found in src/components/Skeletons/CoursePage/content.tsx - About 1 hr to fix

            Function handleFetchQuestionnairesAnswers has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                (page: number) => {
                  if (questionId && courseId) {
                    setLoading(true);
                    fetchQuestionnairesAnswers(
                      QuestionnaireModelType.COURSE,
            Severity: Minor
            Found in src/hooks/courses/useCourseAnswers.ts - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language