RocketChat/Rocket.Chat

View on GitHub
apps/meteor/client/components/deviceManagement/DeviceManagementTable/DeviceManagementTable.tsx

Summary

Maintainability
C
7 hrs
Test Coverage

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

    if (!data && phase === AsyncStatePhase.REJECTED) {
        return (
            <Box display='flex' justifyContent='center' alignItems='center' height='100%'>
                <States>
                    <StatesIcon name='warning' variation='danger' />
apps/meteor/client/views/account/tokens/AccountTokensTable/AccountTokensTable.tsx on lines 123..137

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

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

                <Pagination
                    divider
                    current={current}
                    itemsPerPage={itemsPerPage}
                    count={data?.total || 0}
apps/meteor/client/omnichannel/cannedResponses/CannedResponsesTable.tsx on lines 188..196
apps/meteor/client/omnichannel/monitors/MonitorsTable.tsx on lines 183..191
apps/meteor/client/omnichannel/slaPolicies/SlaTable.tsx on lines 125..133
apps/meteor/client/omnichannel/tags/TagsTable.tsx on lines 118..126
apps/meteor/client/omnichannel/units/UnitsTable.tsx on lines 118..126
apps/meteor/client/views/admin/customEmoji/CustomEmoji.tsx on lines 104..112
apps/meteor/client/views/admin/integrations/IntegrationsTable.tsx on lines 119..127
apps/meteor/client/views/admin/rooms/RoomsTable.tsx on lines 142..150
apps/meteor/client/views/admin/settings/groups/VoipGroupPage/VoipExtensionsPage.tsx on lines 126..134
apps/meteor/client/views/directory/tabs/channels/ChannelsTable/ChannelsTable.tsx on lines 118..126
apps/meteor/client/views/directory/tabs/teams/TeamsTable/TeamsTable.tsx on lines 100..108
apps/meteor/client/views/directory/tabs/users/UsersTable/UsersTable.tsx on lines 124..132
apps/meteor/client/views/omnichannel/agents/AgentsTable/AgentsTable.tsx on lines 105..113
apps/meteor/client/views/omnichannel/departments/DepartmentsTable/DepartmentsTable.tsx on lines 134..142
apps/meteor/client/views/omnichannel/directory/calls/CallTable.tsx on lines 127..135
apps/meteor/client/views/omnichannel/directory/chats/ChatTable.tsx on lines 162..170
apps/meteor/client/views/omnichannel/queueList/QueueListTable.tsx on lines 148..156
apps/meteor/client/views/omnichannel/triggers/TriggersTable.tsx on lines 78..86

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

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