EscolaLMS/Front

View on GitHub

Showing 559 of 559 total issues

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

export const ThumbUp = () => (
  <svg
    width="23"
    height="21"
    viewBox="0 0 23 21"
Severity: Major
Found in src/icons/index.tsx and 10 other locations - About 1 hr to fix
src/icons/index.tsx on lines 298..311
src/icons/index.tsx on lines 313..326
src/icons/index.tsx on lines 817..830
src/icons/index.tsx on lines 832..845
src/icons/index.tsx on lines 974..987
src/icons/index.tsx on lines 989..1002
src/icons/index.tsx on lines 1004..1017
src/icons/index.tsx on lines 1019..1032
src/icons/index.tsx on lines 1034..1047
src/icons/index.tsx on lines 1049..1062

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

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

export const ShareIcon = () => (
  <svg
    width="16"
    height="20"
    viewBox="0 0 16 20"
Severity: Major
Found in src/icons/index.tsx and 10 other locations - About 1 hr to fix
src/icons/index.tsx on lines 283..296
src/icons/index.tsx on lines 298..311
src/icons/index.tsx on lines 313..326
src/icons/index.tsx on lines 817..830
src/icons/index.tsx on lines 974..987
src/icons/index.tsx on lines 989..1002
src/icons/index.tsx on lines 1004..1017
src/icons/index.tsx on lines 1019..1032
src/icons/index.tsx on lines 1034..1047
src/icons/index.tsx on lines 1049..1062

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

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

export const IconChevronDoubleDown = () => (
  <svg
    width="15"
    height="15"
    viewBox="0 0 15 15"
Severity: Major
Found in src/icons/index.tsx and 10 other locations - About 1 hr to fix
src/icons/index.tsx on lines 283..296
src/icons/index.tsx on lines 298..311
src/icons/index.tsx on lines 313..326
src/icons/index.tsx on lines 817..830
src/icons/index.tsx on lines 832..845
src/icons/index.tsx on lines 974..987
src/icons/index.tsx on lines 989..1002
src/icons/index.tsx on lines 1004..1017
src/icons/index.tsx on lines 1034..1047
src/icons/index.tsx on lines 1049..1062

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

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

export const Medal = () => (
  <svg
    width="23"
    height="23"
    viewBox="0 0 23 23"
Severity: Major
Found in src/icons/index.tsx and 10 other locations - About 1 hr to fix
src/icons/index.tsx on lines 283..296
src/icons/index.tsx on lines 313..326
src/icons/index.tsx on lines 817..830
src/icons/index.tsx on lines 832..845
src/icons/index.tsx on lines 974..987
src/icons/index.tsx on lines 989..1002
src/icons/index.tsx on lines 1004..1017
src/icons/index.tsx on lines 1019..1032
src/icons/index.tsx on lines 1034..1047
src/icons/index.tsx on lines 1049..1062

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

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

          .map((consultation: API.Consultation) => (
            <Col key={consultation.id} xs={12} sm={6} md={4} lg={3}>
              <ConsultationCard consultation={consultation} />
            </Col>
          ))}
src/components/Consultations/ConsultationsSlider/index.tsx on lines 109..113

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

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 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();
Severity: Minor
Found in src/components/Subscriptions/Box/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 CourseAccessButton has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

const CourseAccessButton: React.FC<CourseAccessButtonProps> = ({
  course,
  onRequestAccess,
  setModalVisible,
}) => {

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);
Severity: Minor
Found in src/components/Book/BookTermModal/ProposedTermsContent/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 WebinarSidebar has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const WebinarSidebar = () => {
  const {
    webinar: { value: webinarObject },
  } = useContext(EscolaLMSContext);
  const { t } = useTranslation();
Severity: Minor
Found in src/components/Webinars/Webinar/WebinarSidebar/index.tsx - About 1 hr to fix

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

          {buttonStatus === ButtonStatus.USER_BOUGHT_AND_EVENT_FINISHED && (
            <Button onClick={() => push(`/event/${event.id}`)} mode="secondary">
              {t("Show")}
            </Button>
          )}
    Severity: Major
    Found in src/components/Events/Event/EventDetailsSidebar/index.tsx and 1 other location - About 1 hr to fix
    src/components/Events/Event/EventDetailsSidebar/index.tsx on lines 108..115

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

    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

          {buttonStatus === ButtonStatus.DEFAULT && (
            <Button
              onClick={() => push(`/login?referrer=/webinar/${webinarObj?.id}`)}
              mode="secondary"
            >
    src/components/Webinars/Webinar/WebinarSidebar/Buttons/index.tsx on lines 100..107

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

    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

          {buttonStatus === ButtonStatus.DEFAULT && (
            <Button
              onClick={() => push(`/login?referrer=/event/${event.id}`)}
              mode="secondary"
            >
    Severity: Major
    Found in src/components/Events/Event/EventDetailsSidebar/index.tsx and 1 other location - About 1 hr to fix
    src/components/Events/Event/EventDetailsSidebar/index.tsx on lines 84..88

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

    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

          {buttonStatus === ButtonStatus.USER_BOUGHT_AND_WEBINAR_FINISHED && (
            <Button
              onClick={() => push(`/webinar/${webinarObj?.id}`)}
              mode="secondary"
            >
    src/components/Webinars/Webinar/WebinarSidebar/Buttons/index.tsx on lines 136..143

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

    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 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 MyStationaryEvents has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const MyStationaryEvents = () => {
        const { fetchUserStationaryEvents } = useContext(EscolaLMSContext);
        const { t } = useTranslation();
        useEffect(() => {
          fetchUserStationaryEvents();
      Severity: Minor
      Found in src/pages/user/MyStationaryEvents/index.tsx - About 1 hr to fix

        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,
        Severity: Minor
        Found in src/components/Courses/Course/CoursePanelLayout/Schedule/index.tsx - About 1 hr to fix

          Function SubscriptionsPage has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const SubscriptionsPage = () => {
            const { t } = useTranslation();
            const {
              subscriptions,
              isLoading,
          Severity: Minor
          Found in src/pages/subscriptions/index.tsx - About 1 hr to fix

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

              const paginationMeta = useMemo(
                () =>
                  filter === CourseStatus.AUTHORED
                    ? myAuthoredCourses.list?.meta
                    : paginatedProgress.list?.meta,
            Severity: Major
            Found in src/hooks/courses/useProfileCourses.ts and 1 other location - About 1 hr to fix
            src/components/Profile/ProfileCourses/index.tsx on lines 86..92

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

            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

                  {isEnded && consultation.executed_at && (
                    <DateInfo
                      type={DateInfoTypes.ENDED}
                      date={addTimeToDate(
                        consultation.executed_at,
            src/components/Consultations/ConsultationTutorCard/Content/DateInfo/index.tsx on lines 31..39

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

            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

                  {isEnded && consultation.date && (
                    <DateInfo
                      type={DateInfoTypes.ENDED}
                      date={addTimeToDate(
                        consultation.date,
            src/components/Consultations/ConsultationCard/Content/index.tsx on lines 24..32

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

            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