RocketChat/Rocket.Chat

View on GitHub
packages/ui-kit/src/surfaces/contextualBar/UiKitParserContextualBar.spec.ts

Summary

Maintainability
F
2 mos
Test Coverage

File UiKitParserContextualBar.spec.ts has 1857 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import type { OverflowElement } from '../../blocks/elements/OverflowElement';
import type { PlainText } from '../../blocks/text/PlainText';
import { BlockContext } from '../../rendering/BlockContext';
import { UiKitParserContextualBar } from './UiKitParserContextualBar';
import { uiKitContextualBar } from './uiKitContextualBar';

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

    class TestParser extends UiKitParserContextualBar<unknown> {
        plain_text = (element: any, context: any, index: any): any => ({
            component: 'text',
            props: {
                key: index,
    packages/ui-kit/src/surfaces/modal/UiKitParserModal.spec.ts on lines 7..251

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

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

    describe('section', () => {
        it('renders text as plain_text', () => {
            const payload = [
                {
                    type: 'section',
    packages/ui-kit/src/surfaces/attachment/UiKitParserAttachment.spec.ts on lines 221..717
    packages/ui-kit/src/surfaces/banner/UiKitParserBanner.spec.ts on lines 278..774
    packages/ui-kit/src/surfaces/message/UiKitParserMessage.spec.ts on lines 221..717
    packages/ui-kit/src/surfaces/modal/UiKitParserModal.spec.ts on lines 279..775

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

    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

    describe('input', () => {
        it('renders multiline plain text input', () => {
            const payload = [
                {
                    type: 'input',
    packages/ui-kit/src/surfaces/banner/UiKitParserBanner.spec.ts on lines 1377..1795
    packages/ui-kit/src/surfaces/modal/UiKitParserModal.spec.ts on lines 1378..1796

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

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

    describe('actions', () => {
        it('renders all selects', () => {
            const payload = [
                {
                    type: 'actions',
    packages/ui-kit/src/surfaces/attachment/UiKitParserAttachment.spec.ts on lines 795..1143
    packages/ui-kit/src/surfaces/banner/UiKitParserBanner.spec.ts on lines 852..1200
    packages/ui-kit/src/surfaces/message/UiKitParserMessage.spec.ts on lines 795..1143
    packages/ui-kit/src/surfaces/modal/UiKitParserModal.spec.ts on lines 853..1201

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

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

    describe('context', () => {
        it('renders plain text', () => {
            const payload = [
                {
                    type: 'context',
    packages/ui-kit/src/surfaces/attachment/UiKitParserAttachment.spec.ts on lines 1145..1318
    packages/ui-kit/src/surfaces/banner/UiKitParserBanner.spec.ts on lines 1202..1375
    packages/ui-kit/src/surfaces/message/UiKitParserMessage.spec.ts on lines 1145..1318
    packages/ui-kit/src/surfaces/modal/UiKitParserModal.spec.ts on lines 1203..1376

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

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

    describe('conditional', () => {
        it('renders when conditions match', () => {
            const blocks = [
                {
                    type: 'conditional',
    packages/ui-kit/src/surfaces/attachment/UiKitParserAttachment.spec.ts on lines 1320..1427
    packages/ui-kit/src/surfaces/banner/UiKitParserBanner.spec.ts on lines 1797..1904
    packages/ui-kit/src/surfaces/message/UiKitParserMessage.spec.ts on lines 1320..1427
    packages/ui-kit/src/surfaces/modal/UiKitParserModal.spec.ts on lines 1798..1905

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

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

    describe('image', () => {
        it('renders with title', () => {
            const payload = [
                {
                    type: 'image',
    packages/ui-kit/src/surfaces/attachment/UiKitParserAttachment.spec.ts on lines 719..793
    packages/ui-kit/src/surfaces/banner/UiKitParserBanner.spec.ts on lines 776..850
    packages/ui-kit/src/surfaces/message/UiKitParserMessage.spec.ts on lines 719..793
    packages/ui-kit/src/surfaces/modal/UiKitParserModal.spec.ts on lines 777..851

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

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

    describe('divider', () => {
        it('renders', () => {
            const payload = [
                {
                    type: 'divider',
    packages/ui-kit/src/surfaces/attachment/UiKitParserAttachment.spec.ts on lines 202..219
    packages/ui-kit/src/surfaces/banner/UiKitParserBanner.spec.ts on lines 259..276
    packages/ui-kit/src/surfaces/message/UiKitParserMessage.spec.ts on lines 202..219
    packages/ui-kit/src/surfaces/modal/UiKitParserModal.spec.ts on lines 260..277

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

    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