EscolaLMS/sdk

View on GitHub

Showing 334 of 334 total issues

Function CourseAccessContextProvider has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

> = ({ children, defaults, apiUrl, ssrHydration }) => {
  const abortControllers = useRef<Record<string, AbortController | null>>({});

  const { token } = useContext(UserContext);

Severity: Minor
Found in src/react/context/course_access.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 useCart has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const useCart = () => {
  const [cart, setCart] = useState<PogressState>({
    data: undefined,
    loaded: false,
    loading: false,
Severity: Minor
Found in src/react/hooks/useCart.ts - About 1 hr to fix

    Function useProgress has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const useProgress = () => {
      const [progress, setProgress] = useState<PogressState>({
        data: undefined,
        loaded: false,
        loading: false,
    Severity: Minor
    Found in src/react/hooks/useProgress.ts - About 1 hr to fix

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

        const cancelSubscription = useCallback(
          (productId: number) => {
            return token
              ? postCancelSubscription
                  .bind(null, apiUrl)(productId, token)
      Severity: Major
      Found in src/react/context/index.tsx and 1 other location - About 1 hr to fix
      src/react/context/index.tsx on lines 1673..1682

      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

        const topicPing = useCallback(
          (topicId: number) => {
            return token
              ? putTopicPing
                  .bind(null, apiUrl)(topicId, token)
      Severity: Major
      Found in src/react/context/index.tsx and 1 other location - About 1 hr to fix
      src/react/context/index.tsx on lines 749..758

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

        fetchFields: (
          filter: API.FieldsParams
        ) => Promise<
          | void
          | API.DefaultResponse<API.Metadata>
      Severity: Major
      Found in src/react/context/types.ts and 9 other locations - About 1 hr to fix
      src/react/context/types.ts on lines 122..128
      src/react/context/types.ts on lines 194..198
      src/react/context/types.ts on lines 236..242
      src/react/context/types.ts on lines 281..287
      src/react/context/types.ts on lines 307..313
      src/react/context/types.ts on lines 354..358
      src/react/context/types.ts on lines 523..529
      src/react/context/types.ts on lines 545..551
      src/react/context/types.ts on lines 552..558

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

        fetchUserGroups: (
          params: API.UserGroupsParams
        ) => Promise<
          | void
          | API.DefaultResponse<API.UserGroup>
      Severity: Major
      Found in src/react/context/types.ts and 9 other locations - About 1 hr to fix
      src/react/context/types.ts on lines 194..198
      src/react/context/types.ts on lines 236..242
      src/react/context/types.ts on lines 281..287
      src/react/context/types.ts on lines 300..306
      src/react/context/types.ts on lines 307..313
      src/react/context/types.ts on lines 354..358
      src/react/context/types.ts on lines 523..529
      src/react/context/types.ts on lines 545..551
      src/react/context/types.ts on lines 552..558

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

        fetchMyAuthoredCourses: (
          params?: API.PaginationParams
        ) => Promise<
          void | API.DefaultResponse<API.Course> | API.DefaultMetaResponse<API.Course>
        >;
      Severity: Major
      Found in src/react/context/types.ts and 9 other locations - About 1 hr to fix
      src/react/context/types.ts on lines 122..128
      src/react/context/types.ts on lines 236..242
      src/react/context/types.ts on lines 281..287
      src/react/context/types.ts on lines 300..306
      src/react/context/types.ts on lines 307..313
      src/react/context/types.ts on lines 354..358
      src/react/context/types.ts on lines 523..529
      src/react/context/types.ts on lines 545..551
      src/react/context/types.ts on lines 552..558

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

        fetchSemesters: (
          params?: API.SemestersParams
        ) => Promise<
          | void
          | API.DefaultResponse<API.SemesterData>
      Severity: Major
      Found in src/react/context/types.ts and 9 other locations - About 1 hr to fix
      src/react/context/types.ts on lines 122..128
      src/react/context/types.ts on lines 194..198
      src/react/context/types.ts on lines 236..242
      src/react/context/types.ts on lines 281..287
      src/react/context/types.ts on lines 300..306
      src/react/context/types.ts on lines 307..313
      src/react/context/types.ts on lines 354..358
      src/react/context/types.ts on lines 523..529
      src/react/context/types.ts on lines 552..558

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

        fetchAcademicYears: (
          params?: API.AcademicYearParams
        ) => Promise<
          | void
          | API.DefaultResponse<API.AcademicYear>
      Severity: Major
      Found in src/react/context/types.ts and 9 other locations - About 1 hr to fix
      src/react/context/types.ts on lines 122..128
      src/react/context/types.ts on lines 194..198
      src/react/context/types.ts on lines 236..242
      src/react/context/types.ts on lines 281..287
      src/react/context/types.ts on lines 300..306
      src/react/context/types.ts on lines 307..313
      src/react/context/types.ts on lines 354..358
      src/react/context/types.ts on lines 523..529
      src/react/context/types.ts on lines 545..551

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

        fetchCertificates: (
          params?: API.CertificateParams
        ) => Promise<
          | void
          | API.DefaultResponse<API.Certificate>
      Severity: Major
      Found in src/react/context/types.ts and 9 other locations - About 1 hr to fix
      src/react/context/types.ts on lines 122..128
      src/react/context/types.ts on lines 194..198
      src/react/context/types.ts on lines 281..287
      src/react/context/types.ts on lines 300..306
      src/react/context/types.ts on lines 307..313
      src/react/context/types.ts on lines 354..358
      src/react/context/types.ts on lines 523..529
      src/react/context/types.ts on lines 545..551
      src/react/context/types.ts on lines 552..558

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

        fetchEvents: (
          filter: API.EventsParams
        ) => Promise<
          void | API.DefaultResponse<API.Event> | API.DefaultMetaResponse<API.Event>
        >;
      Severity: Major
      Found in src/react/context/types.ts and 9 other locations - About 1 hr to fix
      src/react/context/types.ts on lines 122..128
      src/react/context/types.ts on lines 194..198
      src/react/context/types.ts on lines 236..242
      src/react/context/types.ts on lines 281..287
      src/react/context/types.ts on lines 300..306
      src/react/context/types.ts on lines 307..313
      src/react/context/types.ts on lines 523..529
      src/react/context/types.ts on lines 545..551
      src/react/context/types.ts on lines 552..558

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

        fetchStationaryEvents: (
          filter: API.StationaryEventsParams
        ) => Promise<
          | void
          | API.DefaultResponse<API.StationaryEvent>
      Severity: Major
      Found in src/react/context/types.ts and 9 other locations - About 1 hr to fix
      src/react/context/types.ts on lines 122..128
      src/react/context/types.ts on lines 194..198
      src/react/context/types.ts on lines 236..242
      src/react/context/types.ts on lines 281..287
      src/react/context/types.ts on lines 300..306
      src/react/context/types.ts on lines 354..358
      src/react/context/types.ts on lines 523..529
      src/react/context/types.ts on lines 545..551
      src/react/context/types.ts on lines 552..558

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

        fetchConsultations: (
          filter: API.ConsultationParams
        ) => Promise<
          | void
          | API.DefaultResponse<API.Consultation>
      Severity: Major
      Found in src/react/context/types.ts and 9 other locations - About 1 hr to fix
      src/react/context/types.ts on lines 122..128
      src/react/context/types.ts on lines 194..198
      src/react/context/types.ts on lines 236..242
      src/react/context/types.ts on lines 300..306
      src/react/context/types.ts on lines 307..313
      src/react/context/types.ts on lines 354..358
      src/react/context/types.ts on lines 523..529
      src/react/context/types.ts on lines 545..551
      src/react/context/types.ts on lines 552..558

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

        fetchSubjects: (
          params?: API.SubjectsParams
        ) => Promise<
          | void
          | API.DefaultResponse<API.GroupSubject>
      Severity: Major
      Found in src/react/context/types.ts and 9 other locations - About 1 hr to fix
      src/react/context/types.ts on lines 122..128
      src/react/context/types.ts on lines 194..198
      src/react/context/types.ts on lines 236..242
      src/react/context/types.ts on lines 281..287
      src/react/context/types.ts on lines 300..306
      src/react/context/types.ts on lines 307..313
      src/react/context/types.ts on lines 354..358
      src/react/context/types.ts on lines 545..551
      src/react/context/types.ts on lines 552..558

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

        return (
          <QuestionnairesContext.Provider
            value={{
              fetchQuestionnaires,
              fetchQuestionnaire,
      Severity: Major
      Found in src/react/context/questionnaires.tsx and 2 other locations - About 1 hr to fix
      src/react/context/cart.tsx on lines 191..204
      src/react/context/course_access.tsx on lines 163..176

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

      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

                    byId: prevState.byId
                      ? {
                          ...prevState.byId,
                          [id]: {
                            value: response.data,
      Severity: Major
      Found in src/react/context/index.tsx and 1 other location - About 1 hr to fix
      src/react/context/index.tsx on lines 1436..1449

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

      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

        return (
          <CourseAccessContext.Provider
            value={{
              courseAccess,
              fetchCourseAccess,
      Severity: Major
      Found in src/react/context/course_access.tsx and 2 other locations - About 1 hr to fix
      src/react/context/cart.tsx on lines 191..204
      src/react/context/questionnaires.tsx on lines 119..132

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

      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

        return (
          <CartContext.Provider
            value={{
              cart,
              fetchCart,
      Severity: Major
      Found in src/react/context/cart.tsx and 2 other locations - About 1 hr to fix
      src/react/context/course_access.tsx on lines 163..176
      src/react/context/questionnaires.tsx on lines 119..132

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

      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

                    byId: prevState.byId
                      ? {
                          ...prevState.byId,
                          [id]: {
                            value: response.data,
      Severity: Major
      Found in src/react/context/index.tsx and 1 other location - About 1 hr to fix
      src/react/context/index.tsx on lines 1147..1160

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

      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