Coursemology/coursemology2

View on GitHub
client/app/bundles/course/statistics/pages/StatisticsIndex/staff/StaffStatisticsTable.tsx

Summary

Maintainability
D
1 day
Test Coverage

Function StaffStatisticsTable has 78 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const StaffStatisticsTable: FC<Props> = (props) => {
  const { staffs } = props;
  const { t } = useTranslation();
  const formattedStaffs = staffs.map(processStaff);

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

const translations = defineMessages({
  name: {
    id: 'course.statistics.StatisticsIndex.staff.name',
    defaultMessage: 'Name',
  },
client/app/bundles/course/announcements/components/forms/AnnouncementForm.tsx on lines 33..66
client/app/bundles/course/assessment/skills/components/tables/SkillsTable.tsx on lines 43..76
client/app/bundles/course/discussion/topics/components/cards/CommentCard.tsx on lines 28..61
client/app/bundles/course/experience-points/disbursement/components/forms/DisbursementForm.tsx on lines 34..68
client/app/bundles/course/users/components/navigation/UserManagementTabs.tsx on lines 20..53
client/app/bundles/system/admin/instance/instance/components/buttons/PendingRoleRequestsButtons.tsx on lines 21..55
client/app/lib/components/navigation/CourseSwitcherPopupMenu.tsx on lines 18..51

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

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

        search={{
          searchPlaceholder: t(translations.searchBar),
          searchProps: {
            shouldInclude: (staff, filterValue?: string): boolean => {
              if (!staff.name) return false;
client/app/bundles/course/statistics/pages/StatisticsIndex/course/StudentPerformanceTable.tsx on lines 395..408

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

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

    {
      of: 'numGraded',
      title: t(translations.numGraded),
      sortable: true,
      csvDownloadable: true,
client/app/bundles/course/statistics/pages/StatisticsIndex/staff/StaffStatisticsTable.tsx on lines 72..79

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

    {
      of: 'numStudents',
      title: t(translations.numStudents),
      sortable: true,
      csvDownloadable: true,
client/app/bundles/course/statistics/pages/StatisticsIndex/staff/StaffStatisticsTable.tsx on lines 64..71

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

There are no issues that match your filters.

Category
Status