fbredius/storybook

View on GitHub

Showing 5,758 of 5,758 total issues

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

    it('tuples', () => {
      const input = readFixture('typescript/tuples.tsx');
      expect(input).toMatchInlineSnapshot(`
        "import React, { FC } from 'react';

Severity: Major
Found in addons/docs/src/lib/convert/convert.test.ts and 15 other locations - About 1 hr to fix
addons/docs/src/lib/convert/convert.test.ts on lines 17..60
addons/docs/src/lib/convert/convert.test.ts on lines 61..104
addons/docs/src/lib/convert/convert.test.ts on lines 105..149
addons/docs/src/lib/convert/convert.test.ts on lines 150..221
addons/docs/src/lib/convert/convert.test.ts on lines 222..279
addons/docs/src/lib/convert/convert.test.ts on lines 280..353
addons/docs/src/lib/convert/convert.test.ts on lines 354..386
addons/docs/src/lib/convert/convert.test.ts on lines 387..417
addons/docs/src/lib/convert/convert.test.ts on lines 418..475
addons/docs/src/lib/convert/convert.test.ts on lines 509..544
addons/docs/src/lib/convert/convert.test.ts on lines 545..587
addons/docs/src/lib/convert/convert.test.ts on lines 588..638
addons/docs/src/lib/convert/convert.test.ts on lines 639..686
addons/docs/src/lib/convert/convert.test.ts on lines 687..743
addons/docs/src/lib/convert/convert.test.ts on lines 744..778

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

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

    it('interfaces', () => {
      const input = readFixture('typescript/interfaces.tsx');
      expect(input).toMatchInlineSnapshot(`
        "import React, { FC } from 'react';

Severity: Major
Found in addons/docs/src/lib/convert/convert.test.ts and 15 other locations - About 1 hr to fix
addons/docs/src/lib/convert/convert.test.ts on lines 17..60
addons/docs/src/lib/convert/convert.test.ts on lines 61..104
addons/docs/src/lib/convert/convert.test.ts on lines 105..149
addons/docs/src/lib/convert/convert.test.ts on lines 150..221
addons/docs/src/lib/convert/convert.test.ts on lines 222..279
addons/docs/src/lib/convert/convert.test.ts on lines 280..353
addons/docs/src/lib/convert/convert.test.ts on lines 387..417
addons/docs/src/lib/convert/convert.test.ts on lines 418..475
addons/docs/src/lib/convert/convert.test.ts on lines 476..506
addons/docs/src/lib/convert/convert.test.ts on lines 509..544
addons/docs/src/lib/convert/convert.test.ts on lines 545..587
addons/docs/src/lib/convert/convert.test.ts on lines 588..638
addons/docs/src/lib/convert/convert.test.ts on lines 639..686
addons/docs/src/lib/convert/convert.test.ts on lines 687..743
addons/docs/src/lib/convert/convert.test.ts on lines 744..778

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

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

    it('enums', () => {
      const input = readFixture('typescript/enums.tsx');
      expect(input).toMatchInlineSnapshot(`
        "import React, { FC } from 'react';

Severity: Major
Found in addons/docs/src/lib/convert/convert.test.ts and 15 other locations - About 1 hr to fix
addons/docs/src/lib/convert/convert.test.ts on lines 17..60
addons/docs/src/lib/convert/convert.test.ts on lines 61..104
addons/docs/src/lib/convert/convert.test.ts on lines 150..221
addons/docs/src/lib/convert/convert.test.ts on lines 222..279
addons/docs/src/lib/convert/convert.test.ts on lines 280..353
addons/docs/src/lib/convert/convert.test.ts on lines 354..386
addons/docs/src/lib/convert/convert.test.ts on lines 387..417
addons/docs/src/lib/convert/convert.test.ts on lines 418..475
addons/docs/src/lib/convert/convert.test.ts on lines 476..506
addons/docs/src/lib/convert/convert.test.ts on lines 509..544
addons/docs/src/lib/convert/convert.test.ts on lines 545..587
addons/docs/src/lib/convert/convert.test.ts on lines 588..638
addons/docs/src/lib/convert/convert.test.ts on lines 639..686
addons/docs/src/lib/convert/convert.test.ts on lines 687..743
addons/docs/src/lib/convert/convert.test.ts on lines 744..778

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

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

    it('intersections', () => {
      const input = readFixture('typescript/intersections.tsx');
      expect(input).toMatchInlineSnapshot(`
        "import React, { FC } from 'react';

Severity: Major
Found in addons/docs/src/lib/convert/convert.test.ts and 15 other locations - About 1 hr to fix
addons/docs/src/lib/convert/convert.test.ts on lines 17..60
addons/docs/src/lib/convert/convert.test.ts on lines 61..104
addons/docs/src/lib/convert/convert.test.ts on lines 105..149
addons/docs/src/lib/convert/convert.test.ts on lines 150..221
addons/docs/src/lib/convert/convert.test.ts on lines 280..353
addons/docs/src/lib/convert/convert.test.ts on lines 354..386
addons/docs/src/lib/convert/convert.test.ts on lines 387..417
addons/docs/src/lib/convert/convert.test.ts on lines 418..475
addons/docs/src/lib/convert/convert.test.ts on lines 476..506
addons/docs/src/lib/convert/convert.test.ts on lines 509..544
addons/docs/src/lib/convert/convert.test.ts on lines 545..587
addons/docs/src/lib/convert/convert.test.ts on lines 588..638
addons/docs/src/lib/convert/convert.test.ts on lines 639..686
addons/docs/src/lib/convert/convert.test.ts on lines 687..743
addons/docs/src/lib/convert/convert.test.ts on lines 744..778

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

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

    it('misc', () => {
      const input = readFixture('proptypes/misc.js');
      expect(input).toMatchInlineSnapshot(`
        "import React from 'react';
        import PropTypes from 'prop-types';
Severity: Major
Found in addons/docs/src/lib/convert/convert.test.ts and 15 other locations - About 1 hr to fix
addons/docs/src/lib/convert/convert.test.ts on lines 17..60
addons/docs/src/lib/convert/convert.test.ts on lines 61..104
addons/docs/src/lib/convert/convert.test.ts on lines 105..149
addons/docs/src/lib/convert/convert.test.ts on lines 150..221
addons/docs/src/lib/convert/convert.test.ts on lines 222..279
addons/docs/src/lib/convert/convert.test.ts on lines 280..353
addons/docs/src/lib/convert/convert.test.ts on lines 354..386
addons/docs/src/lib/convert/convert.test.ts on lines 387..417
addons/docs/src/lib/convert/convert.test.ts on lines 418..475
addons/docs/src/lib/convert/convert.test.ts on lines 476..506
addons/docs/src/lib/convert/convert.test.ts on lines 509..544
addons/docs/src/lib/convert/convert.test.ts on lines 545..587
addons/docs/src/lib/convert/convert.test.ts on lines 588..638
addons/docs/src/lib/convert/convert.test.ts on lines 687..743
addons/docs/src/lib/convert/convert.test.ts on lines 744..778

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

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

  componentWillUnmount() {
    this.mounted = false;
    const { api } = this.props;

    api.off(STORY_CHANGED, this.handleStoryChange);
Severity: Major
Found in addons/actions/src/containers/ActionLogger/index.tsx and 1 other location - About 1 hr to fix
addons/actions/src/containers/ActionLogger/index.tsx on lines 37..43

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

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

  if (Array.isArray(dependencies)) {
    dependencySearches = dependencies.map((name) => [name, undefined]);
  } else if (typeof dependencies === 'object') {
    dependencySearches = Object.entries(dependencies);
  }
Severity: Major
Found in lib/cli/src/detect.ts and 1 other location - About 1 hr to fix
lib/cli/src/detect.ts on lines 69..73

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

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

  if (Array.isArray(peerDependencies)) {
    peerDependencySearches = peerDependencies.map((name) => [name, undefined]);
  } else if (typeof peerDependencies === 'object') {
    peerDependencySearches = Object.entries(peerDependencies);
  }
Severity: Major
Found in lib/cli/src/detect.ts and 1 other location - About 1 hr to fix
lib/cli/src/detect.ts on lines 55..59

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

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

  componentDidMount() {
    this.mounted = true;
    const { api } = this.props;

    api.on(EVENT_ID, this.addAction);
Severity: Major
Found in addons/actions/src/containers/ActionLogger/index.tsx and 1 other location - About 1 hr to fix
addons/actions/src/containers/ActionLogger/index.tsx on lines 45..51

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 68.

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

Function commandBuilder has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function commandBuilder(
  options: StorybookBuilderOptions,
  context: BuilderContext
): Observable<StorybookBuilderOutput> {
  return from(setup(options, context)).pipe(
Severity: Minor
Found in app/angular/src/builders/build-storybook/index.ts - About 1 hr to fix

    Function configure has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function configure<TFramework extends AnyFramework>(
      options: {
        storybook: ClientApi<TFramework>;
      } & StoryshotsOptions
    ): void {
    Severity: Minor
    Found in addons/storyshots/storyshots-core/src/frameworks/configure.ts - About 1 hr to fix

      Function WithKeyboardCycle has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        const WithKeyboardCycle = (props: ToolbarMenuProps) => {
          const {
            id,
            toolbar: { items, shortcuts },
          } = props;
      Severity: Minor
      Found in addons/toolbars/src/hoc/withKeyboardCycle.tsx - About 1 hr to fix

        Function useHook has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function useHook(name: string, callback: (hook: Hook) => void, deps?: any[] | undefined): Hook {
          const hooks = getHooksContextOrThrow();
          if (hooks.currentPhase === 'MOUNT') {
            if (deps != null && !Array.isArray(deps)) {
              logger.warn(
        Severity: Minor
        Found in lib/addons/src/hooks.ts - About 1 hr to fix

          Function getLegacyDefaultBuildOptions has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          async function getLegacyDefaultBuildOptions(options: PresetOptions) {
            if (options.angularBrowserTarget !== undefined) {
              // Not use legacy way with builder (`angularBrowserTarget` is defined or null with builder and undefined without)
              return {};
            }
          Severity: Minor
          Found in app/angular/src/server/framework-preset-angular-cli.ts - About 1 hr to fix

            Function popParametersObjectFromDefaultExport has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function popParametersObjectFromDefaultExport(source, ast) {
              let splicedSource = source;
              let parametersSliceOfCode = '';
              let indexWhereToAppend = -1;
              let foundParametersProperty = false;
            Severity: Minor
            Found in lib/source-loader/src/abstract-syntax-tree/traverse-helpers.js - About 1 hr to fix

              Function rootAndGroups has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  const rootAndGroups = [...root, ...groups].reduce((list, name, index) => {
                    const parent = index > 0 && list[index - 1].id;
                    const id = sanitize(parent ? `${parent}-${name}` : name);
              
                    if (parent === id) {
              Severity: Minor
              Found in lib/api/src/lib/stories.ts - About 1 hr to fix

                Function renderDocs has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  async renderDocs({ story }: { story: Story<TFramework> }) {
                    const { id, title, name } = story;
                    const csfFile: CSFFile<TFramework> = await this.storyStore.loadCSFFileByStoryId(id);
                    const docsContext = {
                      id,
                Severity: Minor
                Found in lib/preview-web/src/PreviewWeb.tsx - About 1 hr to fix

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

                        expect(
                          mockChannel.emit.mock.calls.find((call: [string, any]) => call[0] === Events.SET_STORIES)[1]
                        ).toMatchInlineSnapshot(`
                          Object {
                            "globalParameters": Object {},
                  Severity: Major
                  Found in lib/core-client/src/preview/start.test.ts and 10 other locations - About 1 hr to fix
                  lib/core-client/src/preview/start.test.ts on lines 67..141
                  lib/core-client/src/preview/start.test.ts on lines 169..204
                  lib/core-client/src/preview/start.test.ts on lines 449..502
                  lib/core-client/src/preview/start.test.ts on lines 526..580
                  lib/core-client/src/preview/start.test.ts on lines 585..618
                  lib/core-client/src/preview/start.test.ts on lines 638..689
                  lib/core-client/src/preview/start.test.ts on lines 773..843
                  lib/core-client/src/preview/start.test.ts on lines 946..997
                  lib/core-client/src/preview/start.test.ts on lines 1020..1133
                  lib/core-client/src/preview/start.test.ts on lines 1270..1302

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

                        expect(
                          mockChannel.emit.mock.calls.find((call: [string, any]) => call[0] === Events.SET_STORIES)[1]
                        ).toMatchInlineSnapshot(`
                          Object {
                            "globalParameters": Object {},
                  Severity: Major
                  Found in lib/core-client/src/preview/start.test.ts and 10 other locations - About 1 hr to fix
                  lib/core-client/src/preview/start.test.ts on lines 67..141
                  lib/core-client/src/preview/start.test.ts on lines 449..502
                  lib/core-client/src/preview/start.test.ts on lines 526..580
                  lib/core-client/src/preview/start.test.ts on lines 585..618
                  lib/core-client/src/preview/start.test.ts on lines 638..689
                  lib/core-client/src/preview/start.test.ts on lines 773..843
                  lib/core-client/src/preview/start.test.ts on lines 868..939
                  lib/core-client/src/preview/start.test.ts on lines 946..997
                  lib/core-client/src/preview/start.test.ts on lines 1020..1133
                  lib/core-client/src/preview/start.test.ts on lines 1270..1302

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

                        expect(
                          mockChannel.emit.mock.calls.find((call: [string, any]) => call[0] === Events.SET_STORIES)[1]
                        ).toMatchInlineSnapshot(`
                          Object {
                            "globalParameters": Object {},
                  Severity: Major
                  Found in lib/core-client/src/preview/start.test.ts and 10 other locations - About 1 hr to fix
                  lib/core-client/src/preview/start.test.ts on lines 67..141
                  lib/core-client/src/preview/start.test.ts on lines 169..204
                  lib/core-client/src/preview/start.test.ts on lines 449..502
                  lib/core-client/src/preview/start.test.ts on lines 585..618
                  lib/core-client/src/preview/start.test.ts on lines 638..689
                  lib/core-client/src/preview/start.test.ts on lines 773..843
                  lib/core-client/src/preview/start.test.ts on lines 868..939
                  lib/core-client/src/preview/start.test.ts on lines 946..997
                  lib/core-client/src/preview/start.test.ts on lines 1020..1133
                  lib/core-client/src/preview/start.test.ts on lines 1270..1302

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language