fbredius/storybook

View on GitHub

Showing 5,758 of 5,758 total issues

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

  handleEdit() {
    const { handleUpdateValue, originalValue, logger, onSubmitValueParser, keyPath } = this.props;
    const { inputRef, name, deep } = this.state;
    if (!inputRef) return;

lib/components/src/controls/react-editable-json-tree/JsonNodes.tsx on lines 1461..1482

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

      case dataTypes.OBJECT:
        return (
          <JsonObject
            data={data}
            name={name}
lib/components/src/controls/react-editable-json-tree/JsonNodes.tsx on lines 756..783
lib/components/src/controls/react-editable-json-tree/JsonNodes.tsx on lines 812..839

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

    {
      title: '🔧 Addons',
      pathSegment: 'addons',
      type: 'menu',
      children: [
Severity: Major
Found in docs/toc.js and 1 other location - About 7 hrs to fix
docs/toc.js on lines 46..97

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

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

    {
      title: '🖋 Write stories',
      pathSegment: 'writing-stories',
      type: 'menu',
      children: [
Severity: Major
Found in docs/toc.js and 1 other location - About 7 hrs to fix
docs/toc.js on lines 283..334

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

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

File stories.ts has 460 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import global from 'global';
import { toId, sanitize } from '@storybook/csf';
import {
  STORY_PREPARED,
  UPDATE_STORY_ARGS,
Severity: Minor
Found in lib/api/src/modules/stories.ts - About 7 hrs to fix

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

        it('should set webpack "module.rules"', async () => {
          const baseWebpackConfig = newWebpackConfiguration();
          const webpackFinalConfig = await webpackFinal(baseWebpackConfig, options);
    
          expect(webpackFinalConfig.module.rules).toEqual([
    Severity: Major
    Found in app/angular/src/server/framework-preset-angular-cli.test.ts and 1 other location - About 6 hrs to fix
    app/angular/src/server/framework-preset-angular-cli.test.ts on lines 586..613

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

    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

    async function setup(options: StorybookBuilderOptions, context: BuilderContext) {
      let browserOptions: (JsonObject & BrowserBuilderOptions) | undefined;
      let browserTarget: Target | undefined;
    
      if (options.browserTarget) {
    Severity: Major
    Found in app/angular/src/builders/build-storybook/index.ts and 1 other location - About 6 hrs to fix
    app/angular/src/builders/start-storybook/index.ts on lines 113..131

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

    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

    async function setup(options: StorybookBuilderOptions, context: BuilderContext) {
      let browserOptions: (JsonObject & BrowserBuilderOptions) | undefined;
      let browserTarget: Target | undefined;
    
      if (options.browserTarget) {
    Severity: Major
    Found in app/angular/src/builders/start-storybook/index.ts and 1 other location - About 6 hrs to fix
    app/angular/src/builders/build-storybook/index.ts on lines 90..108

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

    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('should set webpack "module.rules"', async () => {
          const baseWebpackConfig = newWebpackConfiguration();
          const webpackFinalConfig = await webpackFinal(baseWebpackConfig, options);
    
          expect(webpackFinalConfig.module.rules).toEqual([
    Severity: Major
    Found in app/angular/src/server/framework-preset-angular-cli.test.ts and 1 other location - About 6 hrs to fix
    app/angular/src/server/framework-preset-angular-cli.test.ts on lines 204..231

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

    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

    File GlobalScrollAreaStyles.tsx has 452 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React from 'react';
    import { Global, Theme, CSSObject, keyframes } from '@storybook/theming';
    
    const hsResizeObserverDummyAnimation = keyframes`0%{z-index:0}to{z-index:-1}`;
    
    
    Severity: Minor
    Found in lib/components/src/ScrollArea/GlobalScrollAreaStyles.tsx - About 6 hrs to fix

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

          return outline && color
            ? {
                boxShadow: `${color} 0 0 0 1px inset`,
                color,
      
      
      Severity: Major
      Found in lib/components/src/Button/Button.tsx and 1 other location - About 6 hrs to fix
      lib/components/src/Button/Button.tsx on lines 170..197

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

      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

          return outline && primary
            ? {
                boxShadow: `${color} 0 0 0 1px inset`,
                color,
      
      
      Severity: Major
      Found in lib/components/src/Button/Button.tsx and 1 other location - About 6 hrs to fix
      lib/components/src/Button/Button.tsx on lines 208..235

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

      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 parse has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
      Open

        parse() {
          // eslint-disable-next-line @typescript-eslint/no-this-alias
          const self = this;
          traverse(this._ast, {
            ExportDefaultDeclaration: {
      Severity: Minor
      Found in lib/csf-tools/src/CsfFile.ts - About 6 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

      export const createButton = ({
        primary = false,
        size = 'medium',
        backgroundColor,
        label,
      Severity: Major
      Found in examples/html-kitchen-sink/stories/from-essentials/Button.ts and 1 other location - About 6 hrs to fix
      lib/cli/src/frameworks/html/ts/Button.ts on lines 29..47

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

      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

      export const createButton = ({
        primary = false,
        size = 'medium',
        backgroundColor,
        label,
      Severity: Major
      Found in lib/cli/src/frameworks/html/ts/Button.ts and 1 other location - About 6 hrs to fix
      examples/html-kitchen-sink/stories/from-essentials/Button.ts on lines 33..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 170.

      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 installStorybook has 166 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const installStorybook = (projectType: ProjectType, options: CommandOptions): Promise<void> => {
        const packageManager = JsPackageManagerFactory.getPackageManager(options.useNpm);
      
        const npmOptions: NpmOptions = {
          installAsDevDependencies: true,
      Severity: Major
      Found in lib/cli/src/initiate.ts - About 6 hrs to fix

        Function parse has 164 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          parse() {
            // eslint-disable-next-line @typescript-eslint/no-this-alias
            const self = this;
            traverse(this._ast, {
              ExportDefaultDeclaration: {
        Severity: Major
        Found in lib/csf-tools/src/CsfFile.ts - About 6 hrs to fix

          File ArgsTable.tsx has 439 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import React, { FC } from 'react';
          import pickBy from 'lodash/pickBy';
          import { styled, ignoreSsrWarning } from '@storybook/theming';
          import { opacify, transparentize, darken, lighten } from 'polished';
          import { Icons } from '../../icon/icon';
          Severity: Minor
          Found in lib/components/src/blocks/ArgsTable/ArgsTable.tsx - About 6 hrs to fix

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

            /* eslint-disable no-underscore-dangle */
            
            import { addons, mockChannel } from '@storybook/addons';
            import {
              FORCE_REMOUNT,
            Severity: Minor
            Found in lib/instrumenter/src/instrumenter.test.ts - About 6 hrs to fix
              Severity
              Category
              Status
              Source
              Language