Coursemology/coursemology2

View on GitHub
client/app/bundles/course/achievement/components/forms/AchievementForm.tsx

Summary

Maintainability
C
1 day
Test Coverage

Function AchievementForm has 94 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const AchievementForm: FC<Props> = (props) => {
  const {
    open,
    title,
    conditionAttributes,

Similar blocks of code found in 10 locations. Consider refactoring.
Invalid

          <Controller
            control={control}
            name="title"
            render={({ field, fieldState }): JSX.Element => (
              <FormTextField
client/app/bundles/course/announcements/components/forms/AnnouncementForm.tsx on lines 108..125
client/app/bundles/course/assessment/skills/components/forms/SkillForm.tsx on lines 101..118
client/app/bundles/course/courses/components/forms/NewCourseForm.tsx on lines 57..74
client/app/bundles/course/forum/components/forms/ForumForm.tsx on lines 65..82
client/app/bundles/course/material/folders/components/forms/FolderForm.tsx on lines 88..105
client/app/bundles/course/material/folders/components/forms/MaterialForm.tsx on lines 65..82
client/app/bundles/course/video/components/forms/VideoForm.tsx on lines 124..141
client/app/bundles/system/admin/admin/components/forms/InstanceForm.tsx on lines 63..80
client/app/bundles/system/admin/admin/components/forms/InstanceForm.tsx on lines 82..99

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

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

          <Controller
            control={control}
            name="description"
            render={({ field, fieldState }): JSX.Element => (
              <FormRichTextField
client/app/bundles/course/announcements/components/forms/AnnouncementForm.tsx on lines 127..143
client/app/bundles/course/assessment/skills/components/forms/SkillForm.tsx on lines 119..135
client/app/bundles/course/courses/components/forms/NewCourseForm.tsx on lines 76..92
client/app/bundles/course/forum/components/forms/ForumForm.tsx on lines 84..100
client/app/bundles/course/material/folders/components/forms/FolderForm.tsx on lines 107..123
client/app/bundles/course/material/folders/components/forms/MaterialForm.tsx on lines 84..100
client/app/bundles/course/video/components/forms/VideoForm.tsx on lines 162..178
client/app/bundles/system/admin/instance/instance/components/forms/InstanceUserRoleRequestForm.tsx on lines 123..139
client/app/bundles/system/admin/instance/instance/components/forms/InstanceUserRoleRequestForm.tsx on lines 141..157
client/app/bundles/system/admin/instance/instance/components/forms/InstanceUserRoleRequestForm.tsx on lines 159..175

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

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 validationSchema = yup.object({
  title: yup.string().required(formTranslations.required),
  description: yup.string().nullable(),
  published: yup.bool(),
});
client/app/bundles/course/forum/components/forms/ForumForm.tsx on lines 42..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 71.

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

    <FormDialog
      editing={editing}
      formName="achievement-form"
      initialValues={initialValues}
      onClose={onClose}
client/app/bundles/course/forum/components/forms/ForumForm.tsx on lines 53..116
client/app/bundles/course/forum/components/forms/ForumTopicForm.tsx on lines 80..158
client/app/bundles/course/forum/components/forms/ForumTopicPostForm.tsx on lines 47..90
client/app/bundles/course/material/folders/components/forms/FolderForm.tsx on lines 76..176
client/app/bundles/course/material/folders/components/forms/MaterialForm.tsx on lines 53..118
client/app/bundles/course/video/components/forms/VideoForm.tsx on lines 112..261

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

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

          {editing && conditionAttributes && (
            <ConditionsManager
              conditionsData={conditionAttributes}
              description={t(translations.unlockConditionsHint)}
              title={t(translations.unlockConditions)}
client/app/bundles/course/assessment/components/AssessmentForm/index.tsx on lines 388..394

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

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

There are no issues that match your filters.

Category
Status