fbredius/storybook

View on GitHub
lib/preview-web/src/PreviewWeb.test.ts

Summary

Maintainability
F
1 mo
Test Coverage

File PreviewWeb.test.ts has 2380 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import global from 'global';
import * as ReactDOM from 'react-dom';
import merge from 'lodash/merge';
import Events, { IGNORED_EXCEPTION } from '@storybook/core-events';
import { logger } from '@storybook/client-logger';
Severity: Major
Found in lib/preview-web/src/PreviewWeb.test.ts - About 6 days to fix

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

          it('passes loaded context to renderToDOM', async () => {
            document.location.search = '?id=component-one--a';
            await createAndRenderPreview();
    
            mockChannel.emit.mockClear();
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 1 day to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 1910..1941

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

    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

          it('passes loaded context to renderToDOM', async () => {
            document.location.search = '?id=component-one--a&viewMode=docs';
            await createAndRenderPreview();
    
            mockChannel.emit.mockClear();
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 1 day to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 1347..1378

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

    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

          it('applies loaders with story context', async () => {
            document.location.search = '?id=component-one--a&viewMode=docs';
            await createAndRenderPreview();
    
            mockChannel.emit.mockClear();
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 1 day to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 1320..1345

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

    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

          it('applies loaders with story context', async () => {
            document.location.search = '?id=component-one--a';
            await createAndRenderPreview();
    
            mockChannel.emit.mockClear();
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 1 day to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 1883..1908

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

    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

          it('emits STORY_PREPARED', async () => {
            document.location.search = '?id=component-one--a';
            await createAndRenderPreview();
    
            mockChannel.emit.mockClear();
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 1 day to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 1858..1881

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

    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

          it('emits STORY_PREPARED', async () => {
            document.location.search = '?id=component-one--a&viewMode=docs';
            await createAndRenderPreview();
    
            mockChannel.emit.mockClear();
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 1 day to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 1295..1318

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

    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

          it('renders exception if renderToDOM throws', async () => {
            document.location.search = '?id=component-one--a&viewMode=docs';
            const preview = await createAndRenderPreview();
    
            const error = new Error('error');
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 7 hrs to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 1380..1399

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

    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

          it('renders exception if renderToDOM throws', async () => {
            document.location.search = '?id=component-one--a';
            const preview = await createAndRenderPreview();
    
            const error = new Error('error');
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 7 hrs to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 1943..1962

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

    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

          it('emits STORY_PREPARED', async () => {
            document.location.search = '?id=component-one--a';
            await createAndRenderPreview();
    
            expect(mockChannel.emit).toHaveBeenCalledWith(Events.STORY_PREPARED, {
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 5 hrs to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 565..580

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

    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

          it('emits STORY_PREPARED', async () => {
            document.location.search = '?id=component-one--a&viewMode=docs';
            await createAndRenderPreview();
    
            expect(mockChannel.emit).toHaveBeenCalledWith(Events.STORY_PREPARED, {
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 5 hrs to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 372..387

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

    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

          it('emits STORY_CHANGED', async () => {
            document.location.search = '?id=component-one--a';
            await createAndRenderPreview();
    
            mockChannel.emit.mockClear();
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 4 hrs to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 1280..1293

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

    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

          it('emits STORY_CHANGED', async () => {
            document.location.search = '?id=component-one--a';
            await createAndRenderPreview();
    
            mockChannel.emit.mockClear();
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 4 hrs to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 1716..1729

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

    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

          it('emits DOCS_RENDERED', async () => {
            document.location.search = '?id=component-one--a';
            await createAndRenderPreview();
    
            mockChannel.emit.mockClear();
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 2 other locations - About 4 hrs to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 1461..1474
    lib/preview-web/src/PreviewWeb.test.ts on lines 2024..2037

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

    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

          it('emits STORY_RENDERED', async () => {
            document.location.search = '?id=component-one--a';
            await createAndRenderPreview();
    
            mockChannel.emit.mockClear();
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 2 other locations - About 4 hrs to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 1774..1787
    lib/preview-web/src/PreviewWeb.test.ts on lines 2024..2037

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

    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

          it('emits STORY_RENDERED', async () => {
            document.location.search = '?id=component-one--a&viewMode=docs';
            await createAndRenderPreview();
    
            mockChannel.emit.mockClear();
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 2 other locations - About 4 hrs to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 1461..1474
    lib/preview-web/src/PreviewWeb.test.ts on lines 1774..1787

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

    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

          it('executes playFunction', async () => {
            document.location.search = '?id=component-one--a';
            await createAndRenderPreview();
    
            mockChannel.emit.mockClear();
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 4 hrs to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 2009..2022

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

    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

          it('executes playFunction', async () => {
            document.location.search = '?id=component-one--a&viewMode=docs';
            await createAndRenderPreview();
    
            mockChannel.emit.mockClear();
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 4 hrs to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 1446..1459

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

    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

          it('does not emit STORY_UNCHANGED', async () => {
            document.location.search = '?id=component-one--a';
            const preview = await createAndRenderPreview();
            mockChannel.emit.mockClear();
    
    
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 3 hrs to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 2110..2119

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

    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

          it('does not emit STORY_CHANGED', async () => {
            document.location.search = '?id=component-one--a';
            const preview = await createAndRenderPreview();
            mockChannel.emit.mockClear();
    
    
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 3 hrs to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 2096..2108

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

    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

            expect(ReactDOM.render).toHaveBeenCalledWith(
              expect.objectContaining({
                type: componentOneExports.default.parameters.docs.container,
                props: expect.objectContaining({
                  context: expect.objectContaining({
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 3 hrs to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 587..600

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

    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

            expect(ReactDOM.render).toHaveBeenCalledWith(
              expect.objectContaining({
                type: componentOneExports.default.parameters.docs.container,
                props: expect.objectContaining({
                  context: expect.objectContaining({
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 3 hrs to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 1758..1771

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

    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

          it('renders preparing state', async () => {
            document.location.search = '?id=component-one--a';
            const preview = await createAndRenderPreview();
    
            emitter.emit(Events.SET_CURRENT_STORY, {
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 3 hrs to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 1703..1714

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

    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

          it('renders preparing state', async () => {
            document.location.search = '?id=component-one--a';
            const preview = await createAndRenderPreview();
    
            emitter.emit(Events.SET_CURRENT_STORY, {
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 3 hrs to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 1267..1278

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

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

        it('updates URL', async () => {
          document.location.search = '?id=component-one--a';
          await createAndRenderPreview();
    
          emitter.emit(Events.SET_CURRENT_STORY, {
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 3 other locations - About 2 hrs to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 1250..1265
    lib/preview-web/src/PreviewWeb.test.ts on lines 1686..1701
    lib/preview-web/src/PreviewWeb.test.ts on lines 1791..1806

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

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

          it('updates URL', async () => {
            document.location.search = '?id=component-one--a';
            await createAndRenderPreview();
    
            emitter.emit(Events.SET_CURRENT_STORY, {
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 3 other locations - About 2 hrs to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 1143..1158
    lib/preview-web/src/PreviewWeb.test.ts on lines 1686..1701
    lib/preview-web/src/PreviewWeb.test.ts on lines 1791..1806

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

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

          it('updates URL', async () => {
            document.location.search = '?id=component-one--a';
            await createAndRenderPreview();
    
            emitter.emit(Events.SET_CURRENT_STORY, {
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 3 other locations - About 2 hrs to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 1143..1158
    lib/preview-web/src/PreviewWeb.test.ts on lines 1250..1265
    lib/preview-web/src/PreviewWeb.test.ts on lines 1791..1806

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

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

          it('updates URL', async () => {
            document.location.search = '?id=component-one--a&viewMode=docs';
            await createAndRenderPreview();
    
            emitter.emit(Events.SET_CURRENT_STORY, {
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 3 other locations - About 2 hrs to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 1143..1158
    lib/preview-web/src/PreviewWeb.test.ts on lines 1250..1265
    lib/preview-web/src/PreviewWeb.test.ts on lines 1686..1701

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

    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

            expect(projectAnnotations.renderToDOM).toHaveBeenCalledWith(
              expect.objectContaining({
                forceRemount: false,
                storyContext: expect.objectContaining({
                  loaded: { l: 7 },
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 2 hrs to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 841..850

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

    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

          expect(projectAnnotations.renderToDOM).toHaveBeenCalledWith(
            expect.objectContaining({
              forceRemount: false,
              storyContext: expect.objectContaining({
                initialArgs: { foo: 'a' },
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 2 hrs to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 724..733

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

    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

            expect(projectAnnotations.renderToDOM).toHaveBeenCalledWith(
              expect.objectContaining({
                forceRemount: false,
                storyContext: expect.objectContaining({
                  loaded: { l: 7 },
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 2 hrs to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 874..883

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

    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

          expect(projectAnnotations.renderToDOM).toHaveBeenCalledWith(
            expect.objectContaining({
              forceRemount: false,
              storyContext: expect.objectContaining({
                initialArgs: { foo: 'a' },
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 2 hrs to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 1004..1013

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

    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

            expect(projectAnnotations.renderToDOM).toHaveBeenCalledWith(
              expect.objectContaining({
                forceRemount: true,
                storyContext: expect.objectContaining({
                  loaded: { l: 7 },
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 1 hr to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 864..873

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

    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

            expect(projectAnnotations.renderToDOM).toHaveBeenCalledWith(
              expect.objectContaining({
                forceRemount: true,
                storyContext: expect.objectContaining({
                  loaded: { l: 7 },
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 1 hr to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 831..840

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

    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

        it('emits the STORY_SPECIFIED event', async () => {
          document.location.search = '?id=component-one--a';
    
          await createAndRenderPreview();
    
    
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 1 hr to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 241..250

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

        it('emits the CURRENT_STORY_WAS_SET event', async () => {
          document.location.search = '?id=component-one--a';
    
          await createAndRenderPreview();
    
    
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 1 hr to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 230..239

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

              preview.onStoriesChanged({
                importFn: newImportFn,
                storyIndex: {
                  v: 3,
                  stories: {
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 1 hr to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 279..293

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

    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

            preview.onStoriesChanged({
              importFn: newImportFn,
              storyIndex: {
                v: 3,
                stories: {
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 1 hr to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 329..343

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

    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

              expect(projectAnnotations.renderToDOM).toHaveBeenCalledWith(
                expect.objectContaining({
                  forceRemount: true,
                  storyContext: expect.objectContaining({
                    id: 'component-one--b',
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 4 other locations - About 1 hr to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 1102..1111
    lib/preview-web/src/PreviewWeb.test.ts on lines 1592..1601
    lib/preview-web/src/PreviewWeb.test.ts on lines 1617..1626
    lib/preview-web/src/PreviewWeb.test.ts on lines 1648..1657

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

              expect(projectAnnotations.renderToDOM).toHaveBeenCalledWith(
                expect.objectContaining({
                  forceRemount: true,
                  storyContext: expect.objectContaining({
                    id: 'component-one--a',
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 4 other locations - About 1 hr to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 1102..1111
    lib/preview-web/src/PreviewWeb.test.ts on lines 1535..1544
    lib/preview-web/src/PreviewWeb.test.ts on lines 1592..1601
    lib/preview-web/src/PreviewWeb.test.ts on lines 1617..1626

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

          expect(projectAnnotations.renderToDOM).toHaveBeenCalledWith(
            expect.objectContaining({
              forceRemount: true,
              storyContext: expect.objectContaining({
                id: 'component-one--a',
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 4 other locations - About 1 hr to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 1535..1544
    lib/preview-web/src/PreviewWeb.test.ts on lines 1592..1601
    lib/preview-web/src/PreviewWeb.test.ts on lines 1617..1626
    lib/preview-web/src/PreviewWeb.test.ts on lines 1648..1657

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

              expect(projectAnnotations.renderToDOM).toHaveBeenCalledWith(
                expect.objectContaining({
                  forceRemount: true,
                  storyContext: expect.objectContaining({
                    id: 'component-one--a',
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 4 other locations - About 1 hr to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 1102..1111
    lib/preview-web/src/PreviewWeb.test.ts on lines 1535..1544
    lib/preview-web/src/PreviewWeb.test.ts on lines 1617..1626
    lib/preview-web/src/PreviewWeb.test.ts on lines 1648..1657

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

              expect(projectAnnotations.renderToDOM).toHaveBeenCalledWith(
                expect.objectContaining({
                  forceRemount: true,
                  storyContext: expect.objectContaining({
                    id: 'component-one--b',
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 4 other locations - About 1 hr to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 1102..1111
    lib/preview-web/src/PreviewWeb.test.ts on lines 1535..1544
    lib/preview-web/src/PreviewWeb.test.ts on lines 1592..1601
    lib/preview-web/src/PreviewWeb.test.ts on lines 1648..1657

    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

          it('emits DOCS_RENDERED', async () => {
            document.location.search = '?id=component-one--a&viewMode=docs';
    
            await createAndRenderPreview();
    
    
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 1 hr to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 531..536

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

    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

          it('emits STORY_RENDERED', async () => {
            document.location.search = '?id=component-one--a';
            await createAndRenderPreview();
    
            expect(mockChannel.emit).toHaveBeenCalledWith(Events.STORY_RENDERED, 'component-one--a');
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 1 hr to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 603..609

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

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

          await expect(
            preview.initialize({
              importFn,
              getProjectAnnotations: () => {
                throw err;
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 3 other locations - About 40 mins to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 2560..2567
    lib/preview-web/src/PreviewWeb.test.ts on lines 2580..2587
    lib/preview-web/src/PreviewWeb.test.ts on lines 2741..2748

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

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

          await expect(
            preview.initialize({
              importFn,
              getProjectAnnotations: () => {
                throw err;
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 3 other locations - About 40 mins to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 117..124
    lib/preview-web/src/PreviewWeb.test.ts on lines 2560..2567
    lib/preview-web/src/PreviewWeb.test.ts on lines 2580..2587

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

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

            await expect(
              preview.initialize({
                importFn,
                getProjectAnnotations: () => {
                  throw err;
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 3 other locations - About 40 mins to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 117..124
    lib/preview-web/src/PreviewWeb.test.ts on lines 2560..2567
    lib/preview-web/src/PreviewWeb.test.ts on lines 2741..2748

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

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

            await expect(
              preview.initialize({
                importFn,
                getProjectAnnotations: () => {
                  throw err;
    Severity: Major
    Found in lib/preview-web/src/PreviewWeb.test.ts and 3 other locations - About 40 mins to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 117..124
    lib/preview-web/src/PreviewWeb.test.ts on lines 2580..2587
    lib/preview-web/src/PreviewWeb.test.ts on lines 2741..2748

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

    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 newGetProjectAnnotations = () => {
          return {
            ...projectAnnotations,
            args: { global: 'added' },
            globals: { a: 'edited' },
    Severity: Minor
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 40 mins to fix
    lib/preview-web/src/PreviewWeb.integration.test.ts on lines 100..107

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

    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

          preview.onKeydown({
            target: { tagName: 'input', getAttribute: jest.fn().mockReturnValue(null) },
          } as any);
    Severity: Minor
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 35 mins to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 2704..2706

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

    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

          preview.onKeydown({
            target: { tagName: 'div', getAttribute: jest.fn().mockReturnValue(null) },
          } as any);
    Severity: Minor
    Found in lib/preview-web/src/PreviewWeb.test.ts and 1 other location - About 35 mins to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 2718..2720

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

    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

          expect(mockChannel.emit).toHaveBeenCalledWith(Events.STORY_ARGS_UPDATED, {
            storyId: 'component-one--a',
            args: { foo: 'a', new: 'value' },
          });
    Severity: Minor
    Found in lib/preview-web/src/PreviewWeb.test.ts and 2 other locations - About 35 mins to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 691..694
    lib/preview-web/src/PreviewWeb.test.ts on lines 2672..2675

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

    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

          expect(mockChannel.emit).toHaveBeenCalledWith(Events.STORY_ARGS_UPDATED, {
            storyId: 'component-one--a',
            args: { foo: 'a', new: 'arg' },
          });
    Severity: Minor
    Found in lib/preview-web/src/PreviewWeb.test.ts and 2 other locations - About 35 mins to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 1015..1018
    lib/preview-web/src/PreviewWeb.test.ts on lines 2672..2675

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

    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

          expect(mockChannel.emit).toHaveBeenCalledWith(Events.STORY_ARGS_UPDATED, {
            storyId: 'component-one--a',
            args: { foo: 'a', global: 'added' },
          });
    Severity: Minor
    Found in lib/preview-web/src/PreviewWeb.test.ts and 2 other locations - About 35 mins to fix
    lib/preview-web/src/PreviewWeb.test.ts on lines 691..694
    lib/preview-web/src/PreviewWeb.test.ts on lines 1015..1018

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

    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

    unused expression, expected an assignment or function call
    Open

    import type { ModuleImportFn } from '@storybook/store';

    Rule: no-unused-expression

    Disallows unused expression statements.

    Unused expressions are expression statements which are not assignments or function calls (and thus usually no-ops).

    Rationale

    Detects potential errors where an assignment or function call was intended.

    Config

    Three arguments may be optionally provided:

    • allow-fast-null-checks allows to use logical operators to perform fast null checks and perform method or function calls for side effects (e.g. e && e.preventDefault()).
    • allow-new allows 'new' expressions for side effects (e.g. new ModifyGlobalState();.
    • allow-tagged-template allows tagged templates for side effects (e.g. this.add\foo`;`.
    Examples
    "no-unused-expression": true
    "no-unused-expression": true,allow-fast-null-checks
    Schema
    {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "allow-fast-null-checks",
          "allow-new",
          "allow-tagged-template"
        ]
      },
      "minLength": 0,
      "maxLength": 3
    }

    For more information see this page.

    Missing semicolon
    Open

    import type { ModuleImportFn } from '@storybook/store';

    Rule: semicolon

    Enforces consistent semicolon usage at the end of every statement.

    Notes
    • Has Fix

    Config

    One of the following arguments must be provided:

    • "always" enforces semicolons at the end of every statement.
    • "never" disallows semicolons at the end of every statement except for when they are necessary.

    The following arguments may be optionally provided:

    • "ignore-interfaces" skips checking semicolons at the end of interface members.
    • "ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
    • "strict-bound-class-methods" disables any special handling of bound class methods and treats them as any other assignment. This option overrides "ignore-bound-class-methods".
    Examples
    "semicolon": true,always
    "semicolon": true,never
    "semicolon": true,always,ignore-interfaces
    "semicolon": true,always,ignore-bound-class-methods
    Schema
    {
      "type": "array",
      "items": [
        {
          "type": "string",
          "enum": [
            "always",
            "never"
          ]
        },
        {
          "type": "string",
          "enum": [
            "ignore-interfaces"
          ]
        }
      ],
      "additionalItems": false
    }

    For more information see this page.

    Missing semicolon
    Open

    import type { ModuleImportFn } from '@storybook/store';

    Rule: semicolon

    Enforces consistent semicolon usage at the end of every statement.

    Notes
    • Has Fix

    Config

    One of the following arguments must be provided:

    • "always" enforces semicolons at the end of every statement.
    • "never" disallows semicolons at the end of every statement except for when they are necessary.

    The following arguments may be optionally provided:

    • "ignore-interfaces" skips checking semicolons at the end of interface members.
    • "ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
    • "strict-bound-class-methods" disables any special handling of bound class methods and treats them as any other assignment. This option overrides "ignore-bound-class-methods".
    Examples
    "semicolon": true,always
    "semicolon": true,never
    "semicolon": true,always,ignore-interfaces
    "semicolon": true,always,ignore-bound-class-methods
    Schema
    {
      "type": "array",
      "items": [
        {
          "type": "string",
          "enum": [
            "always",
            "never"
          ]
        },
        {
          "type": "string",
          "enum": [
            "ignore-interfaces"
          ]
        }
      ],
      "additionalItems": false
    }

    For more information see this page.

    block is empty
    Open

      let openGate = (_?: any) => {};

    Rule: no-empty

    Disallows empty blocks.

    Blocks with a comment inside are not considered empty.

    Rationale

    Empty blocks are often indicators of missing code.

    Config

    If allow-empty-catch is specified, then catch blocks are allowed to be empty. If allow-empty-functions is specified, then function definitions are allowed to be empty.

    Examples
    "no-empty": true
    "no-empty": true,allow-empty-catch
    "no-empty": true,allow-empty-functions
    "no-empty": true,allow-empty-catch,allow-empty-functions
    Schema
    {
      "type": "array",
      "items": {
        "anyOf": [
          {
            "type": "string",
            "enum": [
              "allow-empty-catch"
            ]
          },
          {
            "type": "string",
            "enum": [
              "allow-empty-functions"
            ]
          }
        ]
      }
    }

    For more information see this page.

    unused expression, expected an assignment or function call
    Open

    import type { ModuleImportFn } from '@storybook/store';

    Rule: no-unused-expression

    Disallows unused expression statements.

    Unused expressions are expression statements which are not assignments or function calls (and thus usually no-ops).

    Rationale

    Detects potential errors where an assignment or function call was intended.

    Config

    Three arguments may be optionally provided:

    • allow-fast-null-checks allows to use logical operators to perform fast null checks and perform method or function calls for side effects (e.g. e && e.preventDefault()).
    • allow-new allows 'new' expressions for side effects (e.g. new ModifyGlobalState();.
    • allow-tagged-template allows tagged templates for side effects (e.g. this.add\foo`;`.
    Examples
    "no-unused-expression": true
    "no-unused-expression": true,allow-fast-null-checks
    Schema
    {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "allow-fast-null-checks",
          "allow-new",
          "allow-tagged-template"
        ]
      },
      "minLength": 0,
      "maxLength": 3
    }

    For more information see this page.

    unused expression, expected an assignment or function call
    Open

    import type { ModuleImportFn } from '@storybook/store';

    Rule: no-unused-expression

    Disallows unused expression statements.

    Unused expressions are expression statements which are not assignments or function calls (and thus usually no-ops).

    Rationale

    Detects potential errors where an assignment or function call was intended.

    Config

    Three arguments may be optionally provided:

    • allow-fast-null-checks allows to use logical operators to perform fast null checks and perform method or function calls for side effects (e.g. e && e.preventDefault()).
    • allow-new allows 'new' expressions for side effects (e.g. new ModifyGlobalState();.
    • allow-tagged-template allows tagged templates for side effects (e.g. this.add\foo`;`.
    Examples
    "no-unused-expression": true
    "no-unused-expression": true,allow-fast-null-checks
    Schema
    {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "allow-fast-null-checks",
          "allow-new",
          "allow-tagged-template"
        ]
      },
      "minLength": 0,
      "maxLength": 3
    }

    For more information see this page.

    Missing semicolon
    Open

    import type { ModuleImportFn } from '@storybook/store';

    Rule: semicolon

    Enforces consistent semicolon usage at the end of every statement.

    Notes
    • Has Fix

    Config

    One of the following arguments must be provided:

    • "always" enforces semicolons at the end of every statement.
    • "never" disallows semicolons at the end of every statement except for when they are necessary.

    The following arguments may be optionally provided:

    • "ignore-interfaces" skips checking semicolons at the end of interface members.
    • "ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
    • "strict-bound-class-methods" disables any special handling of bound class methods and treats them as any other assignment. This option overrides "ignore-bound-class-methods".
    Examples
    "semicolon": true,always
    "semicolon": true,never
    "semicolon": true,always,ignore-interfaces
    "semicolon": true,always,ignore-bound-class-methods
    Schema
    {
      "type": "array",
      "items": [
        {
          "type": "string",
          "enum": [
            "always",
            "never"
          ]
        },
        {
          "type": "string",
          "enum": [
            "ignore-interfaces"
          ]
        }
      ],
      "additionalItems": false
    }

    For more information see this page.

    There are no issues that match your filters.

    Category
    Status