fbredius/storybook

View on GitHub

Showing 5,758 of 5,758 total issues

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

export const PropsWriter = ({
  numberOptional = 1,
  stringOptional = 'stringOptional',
  booleanOptional = false,
  arrayOptional = ['array', 'optional'],
addons/docs/src/frameworks/react/__testfixtures__/js-function-component-inline-defaults/input.js on lines 11..39

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

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 function webpackFinal(webpackConfig: any = {}, options: Options) {
  let vueDocgenOptions = {};

  options.presetsList?.forEach((preset) => {
    if (preset.name.includes('addon-docs') && preset.options.vueDocgenOptions) {
Severity: Major
Found in addons/docs/src/frameworks/vue3/preset.ts and 1 other location - About 1 day to fix
addons/docs/src/frameworks/vue/preset.ts on lines 3..28

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

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 function webpackFinal(webpackConfig: any = {}, options: Options) {
  let vueDocgenOptions = {};

  options.presetsList?.forEach((preset) => {
    if (preset.name.includes('addon-docs') && preset.options.vueDocgenOptions) {
Severity: Major
Found in addons/docs/src/frameworks/vue/preset.ts and 1 other location - About 1 day to fix
addons/docs/src/frameworks/vue3/preset.ts on lines 3..28

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

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 prepareStory.test.ts has 523 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import global from 'global';
import addons, { HooksContext } from '@storybook/addons';
import {
  AnyFramework,
  ArgsEnhancer,
Severity: Major
Found in lib/store/src/csf/prepareStory.test.ts - About 1 day to fix

    Function run has 213 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function run() {
      const prompts = require('prompts');
      const program = require('commander');
      const chalk = require('chalk');
      const log = require('npmlog');
    Severity: Major
    Found in scripts/bootstrap.js - About 1 day to fix

      Function transformer has 211 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function transformer(file, api, options) {
        const LITERAL = ['ts', 'tsx'].includes(options.parser) ? 'StringLiteral' : 'Literal';
      
        const j = api.jscodeshift;
        const root = j(file.source);
      Severity: Major
      Found in lib/codemod/src/transforms/storiesof-to-csf.js - About 1 day to fix

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

        export const Basic = () => (
          <div>
            <div
              style={{
                display: 'grid',
        Severity: Major
        Found in examples/official-storybook/stories/addon-outline.stories.js and 1 other location - About 1 day to fix
        examples/official-storybook/stories/addon-measure/Grid.stories.js on lines 16..46

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

        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 Basic = () => (
          <div>
            <div
              style={{
                display: 'grid',
        examples/official-storybook/stories/addon-outline.stories.js on lines 16..46

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

        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 toc.js has 515 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module.exports = {
          toc: [
            {
              title: '🚀 Get started',
              pathSegment: 'get-started',
        Severity: Major
        Found in docs/toc.js - About 1 day to fix

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

                case 'stacked': {
                  return (
                    <Fragment>
                      <Symbols icons={['folder', 'component', 'document', 'bookmarkhollow']} />
                      <ThemeProvider theme={convert(themes.light)}>
          Severity: Major
          Found in examples/official-storybook/preview.js and 1 other location - About 1 day to fix
          examples/official-storybook/preview.js on lines 94..113

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

          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

                case 'side-by-side': {
                  return (
                    <Fragment>
                      <Symbols icons={['folder', 'component', 'document', 'bookmarkhollow']} />
                      <ThemeProvider theme={convert(themes.light)}>
          Severity: Major
          Found in examples/official-storybook/preview.js and 1 other location - About 1 day to fix
          examples/official-storybook/preview.js on lines 114..133

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

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

          export const init: ModuleFn = ({ store, fullAPI }) => {
            const api: SubAPI = {
              // Getting and setting shortcuts
              getShortcutKeys(): Shortcuts {
                return store.getState().shortcuts;
          Severity: Minor
          Found in lib/api/src/modules/shortcuts.ts - About 1 day 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

          interface JsonValueProps {
            name: string;
            value: any;
            originalValue?: any;
            keyPath?: string[];
          lib/components/src/controls/react-editable-json-tree/JsonNodes.tsx on lines 678..695

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

          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

          interface JsonFunctionValueProps {
            name: string;
            value: any;
            originalValue?: any;
            keyPath?: string[];
          lib/components/src/controls/react-editable-json-tree/JsonNodes.tsx on lines 1570..1587

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

          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 AccountForm.tsx has 504 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { keyframes, styled } from '@storybook/theming';
          import {
            ErrorMessage,
            Field as FormikInput,
            Form as FormikForm,
          Severity: Major
          Found in examples/react-ts/src/AccountForm.tsx - About 1 day to fix

            File AccountForm.tsx has 504 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /* eslint-disable import/no-extraneous-dependencies */
            import { Icons, WithTooltip } from '@storybook/components';
            import { keyframes, styled } from '@storybook/theming';
            import {
              ErrorMessage,
            Severity: Major
            Found in addons/interactions/src/components/AccountForm/AccountForm.tsx - About 1 day to fix

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

                beforeEach(async () => {
                  const registry = new schema.CoreSchemaRegistry();
                  registry.addPostTransform(schema.transforms.addUndefinedDefaults);
              
                  architectHost = new TestingArchitectHost();
              Severity: Major
              Found in app/angular/src/builders/start-storybook/index.spec.ts and 1 other location - About 1 day to fix
              app/angular/src/builders/build-storybook/index.spec.ts on lines 19..50

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

              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

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

                beforeEach(async () => {
                  const registry = new schema.CoreSchemaRegistry();
                  registry.addPostTransform(schema.transforms.addUndefinedDefaults);
              
                  architectHost = new TestingArchitectHost();
              Severity: Major
              Found in app/angular/src/builders/build-storybook/index.spec.ts and 1 other location - About 1 day to fix
              app/angular/src/builders/start-storybook/index.spec.ts on lines 19..49

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

              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 (error instanceof Error) {
                    if ((error as any).error) {
                      logger.error((error as any).error);
                    } else if ((error as any).stats && (error as any).stats.compilation.errors) {
                      (error as any).stats.compilation.errors.forEach((e: any) => logger.plain(e));
              Severity: Major
              Found in lib/core-server/src/build-dev.ts and 1 other location - About 7 hrs to fix
              app/angular/src/builders/utils/build-standalone-errors-handler.ts on lines 9..19

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

              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 (error instanceof Error) {
                  if ((error as any).error) {
                    logger.error((error as any).error);
                  } else if ((error as any).stats && (error as any).stats.compilation.errors) {
                    (error as any).stats.compilation.errors.forEach((e: any) => logger.plain(e));
              lib/core-server/src/build-dev.ts on lines 150..160

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

              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