fbredius/storybook

View on GitHub

Showing 5,758 of 5,758 total issues

Function ArgRow has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const ArgRow: FC<ArgRowProps> = (props) => {
  const { row, updateArgs, compact, expandable, initialExpandedArgs } = props;
  const { name, description } = row;
  const table = (row.table || {}) as TableAnnotation;
  const type = table.type || row.type;
Severity: Minor
Found in lib/components/src/blocks/ArgsTable/ArgRow.tsx - About 1 hr to fix

    Function watchStorySpecifiers has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function watchStorySpecifiers(
      specifiers: NormalizedStoriesSpecifier[],
      options: { workingDir: Path },
      onInvalidate: (specifier: NormalizedStoriesSpecifier, path: Path, removed: boolean) => void
    ) {
    Severity: Minor
    Found in lib/core-server/src/utils/watch-story-specifiers.ts - About 1 hr to fix

      Function outputStartupInformation has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function outputStartupInformation(options: {
        updateInfo: VersionCheck;
        version: string;
        name: string;
        address: string;
      Severity: Minor
      Found in lib/core-server/src/utils/output-startup-information.ts - About 1 hr to fix

        Function report has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        async function report() {
          const hookFailures: { [file: string]: [string, string][] } = {};
          const reports: any[] = [];
          try {
            const testFiles = await fs.readdir(screensDir);
        Severity: Minor
        Found in cypress/report-teamcity-metadata.ts - About 1 hr to fix

          Function generateTypeFromString has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function generateTypeFromString(value: string, originalTypeName: string): TypeDef {
            const { inferredType, ast } = inspectValue(value);
            const { type } = inferredType;
          
            let short;
          Severity: Minor
          Found in addons/docs/src/frameworks/react/propTypes/createType.ts - About 1 hr to fix

            Function render has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              render() {
                const { Sidebar, Preview, Panel, Notifications, pages, viewMode, options, docsOnly } =
                  this.props;
            
                const { active } = this.state;
            Severity: Minor
            Found in lib/ui/src/components/layout/mobile.tsx - About 1 hr to fix

              Function useStatics has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export async function useStatics(router: any, options: Options) {
                let hasCustomFavicon = false;
                const staticDirs = await options.presets.apply<StorybookConfig['staticDirs']>('staticDirs');
              
                if (staticDirs && options.staticDir) {
              Severity: Minor
              Found in lib/core-server/src/utils/server-statics.ts - About 1 hr to fix

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

                        const { argTypes } = prepareStory(
                          { id, name, argTypes: { a: { name: 'b' } } },
                          { id, title },
                          { render, argTypesEnhancers: [enhancer] }
                        );
                Severity: Major
                Found in lib/store/src/csf/prepareStory.test.ts and 1 other location - About 1 hr to fix
                lib/store/src/csf/prepareStory.test.ts on lines 297..301

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 71.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                        const { argTypes } = prepareStory(
                          { id, name, argTypes: { a: { name: 'b' } } },
                          { id, title },
                          { render, argTypesEnhancers: [enhancer] }
                        );
                Severity: Major
                Found in lib/store/src/csf/prepareStory.test.ts and 1 other location - About 1 hr to fix
                lib/store/src/csf/prepareStory.test.ts on lines 311..315

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 71.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                  withRoot: {
                    '1': true,
                    '2': false,
                    '1-11': true,
                    '1-12-121': false,
                Severity: Major
                Found in lib/ui/src/components/sidebar/mockdata.ts and 1 other location - About 1 hr to fix
                lib/ui/src/components/sidebar/mockdata.ts on lines 254..268

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 71.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                    resetStoryArgs: (story, argNames?: [string]) => {
                      const { id: storyId, refId } = story;
                      fullAPI.emit(RESET_STORY_ARGS, {
                        storyId,
                        argNames,
                Severity: Major
                Found in lib/api/src/modules/stories.ts and 1 other location - About 1 hr to fix
                lib/api/src/modules/stories.ts on lines 335..344

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 71.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                      refs
                        ? (new VirtualModulePlugin({
                            [path.resolve(path.join(configDir, `generated-refs.js`))]: refsTemplate.replace(
                              `'{{refs}}'`,
                              JSON.stringify(refs)
                Severity: Major
                Found in lib/manager-webpack5/src/presets/manager-preset.ts and 1 other location - About 1 hr to fix
                lib/manager-webpack4/src/presets/manager-preset.ts on lines 82..89

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 71.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                    case InspectionType.OBJECT: {
                      const { depth } = inferredType as InspectionObject;
                
                      short = OBJECT_CAPTION;
                      compact = depth === 1 ? prettyObject(ast, true) : null;
                Severity: Major
                Found in addons/docs/src/frameworks/react/propTypes/createType.ts and 1 other location - About 1 hr to fix
                addons/docs/src/frameworks/react/propTypes/createType.ts on lines 144..151

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 71.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                    updateStoryArgs: (story, updatedArgs) => {
                      const { id: storyId, refId } = story;
                      fullAPI.emit(UPDATE_STORY_ARGS, {
                        storyId,
                        updatedArgs,
                Severity: Major
                Found in lib/api/src/modules/stories.ts and 1 other location - About 1 hr to fix
                lib/api/src/modules/stories.ts on lines 345..354

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 71.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                  withRoot: {
                    '1': false,
                    '2': false,
                    '1-11': false,
                    '1-12-121': false,
                Severity: Major
                Found in lib/ui/src/components/sidebar/mockdata.ts and 1 other location - About 1 hr to fix
                lib/ui/src/components/sidebar/mockdata.ts on lines 282..296

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 71.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                    case InspectionType.ARRAY: {
                      const { depth } = inferredType as InspectionArray;
                
                      short = ARRAY_CAPTION;
                      compact = depth <= 2 ? prettyArray(ast, true) : null;
                Severity: Major
                Found in addons/docs/src/frameworks/react/propTypes/createType.ts and 1 other location - About 1 hr to fix
                addons/docs/src/frameworks/react/propTypes/createType.ts on lines 128..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 71.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

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

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 71.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

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

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 71.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                      refs
                        ? (new VirtualModulePlugin({
                            [path.resolve(path.join(configDir, `generated-refs.js`))]: refsTemplate.replace(
                              `'{{refs}}'`,
                              JSON.stringify(refs)
                Severity: Major
                Found in lib/manager-webpack4/src/presets/manager-preset.ts and 1 other location - About 1 hr to fix
                lib/manager-webpack5/src/presets/manager-preset.ts on lines 81..88

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 71.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Function withBackground has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const withBackground = (
                  StoryFn: StoryFunction<AnyFramework>,
                  context: StoryContext<AnyFramework>
                ) => {
                  const { globals, parameters } = context;
                Severity: Minor
                Found in addons/backgrounds/src/decorators/withBackground.ts - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language