fbredius/storybook

View on GitHub

Showing 5,758 of 5,758 total issues

Function applyPresets has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function applyPresets(
  presets: LoadedPreset[],
  extension: string,
  config: any,
  args: any,
Severity: Minor
Found in lib/core-common/src/presets.ts - About 1 hr to fix

    Function selectStory has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        selectStory: (kindOrId = undefined, story = undefined, options = {}) => {
          const { ref, viewMode: viewModeFromArgs } = options;
          const {
            viewMode: viewModeFromState = 'story',
            storyId,
    Severity: Minor
    Found in lib/api/src/modules/stories.ts - About 1 hr to fix

      Function eventToShortcut has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const eventToShortcut = (e: KeyboardEvent): KeyCollection | null => {
        // Meta key only doesn't map to a shortcut
        if (['Meta', 'Alt', 'Control', 'Shift'].includes(e.key)) {
          return null;
        }
      Severity: Minor
      Found in lib/api/src/lib/shortcut.ts - About 1 hr to fix

        Function normalizeStory has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function normalizeStory<TFramework extends AnyFramework>(
          key: StoryId,
          storyAnnotations: LegacyStoryAnnotationsOrFn<TFramework>,
          meta: ComponentAnnotations<TFramework>
        ): NormalizedStoryAnnotations<TFramework> {
        Severity: Minor
        Found in lib/store/src/csf/normalizeStory.ts - About 1 hr to fix

          Function executeLoadable has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function executeLoadable(loadable: Loadable) {
            let reqs = null;
            // todo discuss / improve type check
            if (Array.isArray(loadable)) {
              reqs = loadable;
          Severity: Minor
          Found in lib/core-client/src/preview/executeLoadable.ts - About 1 hr to fix

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

              const defaultExportWithTitle = root
                .find(j.ExportDefaultDeclaration)
                .filter((def) => def.node.declaration.properties.map((p) => p.key.name).includes('title'));
            Severity: Major
            Found in lib/codemod/src/transforms/csf-to-mdx.js and 1 other location - About 1 hr to fix
            lib/codemod/src/transforms/upgrade-hierarchy-separators.js on lines 24..26

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

            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

            ForwardRefButtonRender.propTypes = {
              /** Boolean indicating whether the button should render as disabled */
              disabled: PropTypes.bool,
              /** button label. */
              label: PropTypes.string.isRequired,
            Severity: Major
            Found in examples/official-storybook/components/ForwardRefButton.js and 3 other locations - About 1 hr to fix
            examples/official-storybook/components/BaseButton.js on lines 17..26
            examples/official-storybook/components/ForwardRefButton.js on lines 38..47
            examples/official-storybook/components/NamedExportButton.js on lines 13..22

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

            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

            ForwardRefButtonOuterPropTypes.propTypes = {
              /** Boolean indicating whether the button should render as disabled */
              disabled: PropTypes.bool,
              /** button label. */
              label: PropTypes.string.isRequired,
            Severity: Major
            Found in examples/official-storybook/components/ForwardRefButton.js and 3 other locations - About 1 hr to fix
            examples/official-storybook/components/BaseButton.js on lines 17..26
            examples/official-storybook/components/ForwardRefButton.js on lines 9..18
            examples/official-storybook/components/NamedExportButton.js on lines 13..22

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

            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

              root
                .find(j.ExportDefaultDeclaration)
                .filter((def) => def.node.declaration.properties.map((p) => p.key.name).includes('title'))
            Severity: Major
            Found in lib/codemod/src/transforms/upgrade-hierarchy-separators.js and 1 other location - About 1 hr to fix
            lib/codemod/src/transforms/csf-to-mdx.js on lines 100..102

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

            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

            NamedExportButton.propTypes = {
              /** Boolean indicating whether the button should render as disabled */
              disabled: PropTypes.bool,
              /** button label. */
              label: PropTypes.string.isRequired,
            examples/official-storybook/components/BaseButton.js on lines 17..26
            examples/official-storybook/components/ForwardRefButton.js on lines 9..18
            examples/official-storybook/components/ForwardRefButton.js on lines 38..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 65.

            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

            BaseButton.propTypes = {
              /** Boolean indicating whether the button should render as disabled */
              disabled: PropTypes.bool,
              /** button label. */
              label: PropTypes.string.isRequired,
            Severity: Major
            Found in examples/official-storybook/components/BaseButton.js and 3 other locations - About 1 hr to fix
            examples/official-storybook/components/ForwardRefButton.js on lines 9..18
            examples/official-storybook/components/ForwardRefButton.js on lines 38..47
            examples/official-storybook/components/NamedExportButton.js on lines 13..22

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

            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

            Header.propTypes = {
              user: PropTypes.shape({}),
              onLogin: PropTypes.func.isRequired,
              onLogout: PropTypes.func.isRequired,
              onCreateAccount: PropTypes.func.isRequired,
            Severity: Major
            Found in lib/cli/src/frameworks/preact/Header.jsx and 2 other locations - About 1 hr to fix
            lib/cli/src/frameworks/preact/Page.jsx on lines 63..68
            lib/cli/src/frameworks/react/js/Header.jsx on lines 48..53

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

            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

            Page.propTypes = {
              user: PropTypes.shape({}),
              onLogin: PropTypes.func.isRequired,
              onLogout: PropTypes.func.isRequired,
              onCreateAccount: PropTypes.func.isRequired,
            Severity: Major
            Found in lib/cli/src/frameworks/preact/Page.jsx and 2 other locations - About 1 hr to fix
            lib/cli/src/frameworks/preact/Header.jsx on lines 44..49
            lib/cli/src/frameworks/react/js/Header.jsx on lines 48..53

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

            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

            Header.propTypes = {
              user: PropTypes.shape({}),
              onLogin: PropTypes.func.isRequired,
              onLogout: PropTypes.func.isRequired,
              onCreateAccount: PropTypes.func.isRequired,
            Severity: Major
            Found in lib/cli/src/frameworks/react/js/Header.jsx and 2 other locations - About 1 hr to fix
            lib/cli/src/frameworks/preact/Header.jsx on lines 44..49
            lib/cli/src/frameworks/preact/Page.jsx on lines 63..68

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

            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('adds "./" to a normalized relative path', () => {
                const filename = path.join('src', 'Comp.story.js');
                expect(normalizeStoryPath(filename)).toEqual(`.${path.sep}${filename}`);
              });
            Severity: Major
            Found in lib/core-common/src/utils/__tests__/paths.test.ts and 1 other location - About 1 hr to fix
            lib/core-common/src/utils/__tests__/paths.test.ts on lines 30..33

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

            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

                  alias: {
                    ...(features?.emotionAlias ? themingPaths : {}),
                    ...storybookPaths,
                    react: path.dirname(require.resolve('react/package.json')),
                    'react-dom': path.dirname(require.resolve('react-dom/package.json')),
            Severity: Major
            Found in lib/builder-webpack5/src/preview/iframe-webpack.config.ts and 1 other location - About 1 hr to fix
            lib/builder-webpack4/src/preview/iframe-webpack.config.ts on lines 240..245

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

            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

                  alias: {
                    ...(features?.emotionAlias ? themingPaths : {}),
                    ...storybookPaths,
                    react: path.dirname(require.resolve('react/package.json')),
                    'react-dom': path.dirname(require.resolve('react-dom/package.json')),
            Severity: Major
            Found in lib/builder-webpack4/src/preview/iframe-webpack.config.ts and 1 other location - About 1 hr to fix
            lib/builder-webpack5/src/preview/iframe-webpack.config.ts on lines 246..251

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 65.

            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

            function interopRequireDefault(filePath: string) {
              // eslint-disable-next-line global-require,import/no-dynamic-require
              const result = require(filePath);
            
              const isES6DefaultExported =
            Severity: Major
            Found in lib/core-common/src/presets.ts and 1 other location - About 1 hr to fix
            lib/core-common/src/utils/interpret-require.ts on lines 50..58

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

            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

            function interopRequireDefault(filePath: string) {
              // eslint-disable-next-line import/no-dynamic-require,global-require
              const result = require(filePath);
            
              const isES6DefaultExported =
            Severity: Major
            Found in lib/core-common/src/utils/interpret-require.ts and 1 other location - About 1 hr to fix
            lib/core-common/src/presets.ts on lines 127..135

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

            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

                      {groups.ungrouped.map((row) => (
                        <ArgRow key={row.key} row={row} arg={args && args[row.key]} {...common} />
                      ))}
            Severity: Major
            Found in lib/components/src/blocks/ArgsTable/ArgsTable.tsx and 1 other location - About 1 hr to fix
            lib/components/src/blocks/ArgsTable/ArgsTable.tsx on lines 484..486

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

            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