fbredius/storybook

View on GitHub

Showing 5,758 of 5,758 total issues

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

import path from 'path';
import { normalizeStoriesEntry, NormalizedStoriesSpecifier } from '@storybook/core-common';
import { readCsfOrMdx, getStorySortParameter } from '@storybook/csf-tools';

import { StoryIndexGenerator } from './StoryIndexGenerator';
Severity: Minor
Found in lib/core-server/src/utils/StoryIndexGenerator.test.ts - About 2 hrs to fix

    Function constructor has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      constructor(props: ManagerProviderProps) {
        super(props);
        const {
          location,
          path,
    Severity: Minor
    Found in lib/api/src/index.tsx - About 2 hrs to fix

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

        if (!compiler) {
          const err = `${config.name}: missing webpack compiler at runtime!`;
          logger.error(err);
          // eslint-disable-next-line consistent-return
          return {
      Severity: Major
      Found in lib/manager-webpack4/src/index.ts and 1 other location - About 2 hrs to fix
      lib/manager-webpack5/src/index.ts on lines 82..91

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

      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

          @Component({
            template: '',
            inputs: ['input', 'inputWithBindingPropertyName'],
            outputs: ['outputWithBindingPropertyName'],
          })
      app/angular/src/client/preview/angular-beta/utils/NgComponentAnalyzer.test.ts on lines 43..60

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

      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

          @Component({
            template: '',
            inputs: ['inputInComponentMetadata'],
            outputs: ['outputInComponentMetadata'],
          })
      app/angular/src/client/preview/angular-beta/utils/NgComponentAnalyzer.test.ts on lines 84..101

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

      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

        if (!compiler) {
          const err = `${config.name}: missing webpack compiler at runtime!`;
          logger.error(err);
          // eslint-disable-next-line consistent-return
          return {
      Severity: Major
      Found in lib/manager-webpack5/src/index.ts and 1 other location - About 2 hrs to fix
      lib/manager-webpack4/src/index.ts on lines 82..91

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

      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 writeConfig = async (config: ConfigFile, fileName?: string) => {
        const fname = fileName || config.fileName;
        if (!fname) throw new Error('Please specify a fileName for writeConfig');
        await fs.writeFile(fname, await formatConfig(config));
      };
      Severity: Major
      Found in lib/csf-tools/src/ConfigFile.ts and 1 other location - About 2 hrs to fix
      lib/csf-tools/src/CsfFile.ts on lines 422..426

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

      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

      ObjectOf.args = {
        ...baseArgs,
        row: {
          key: 'someObject',
          name: 'Some Object',
      Severity: Major
      Found in lib/components/src/blocks/ArgsTable/ArgRow.stories.tsx and 1 other location - About 2 hrs to fix
      lib/components/src/blocks/ArgsTable/ArgRow.stories.tsx on lines 199..211

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

      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

              this.setState(call.storyId, (state) => ({
                callRefsByResult: new Map([
                  ...Array.from(state.callRefsByResult.entries()),
                  [result, { __callId__: call.id, retain: call.retain }],
                ]),
      Severity: Major
      Found in lib/instrumenter/src/instrumenter.ts and 1 other location - About 2 hrs to fix
      lib/instrumenter/src/instrumenter.ts on lines 407..412

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

      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

      ArrayOf.args = {
        ...baseArgs,
        row: {
          key: 'someArray',
          name: 'Some Array',
      Severity: Major
      Found in lib/components/src/blocks/ArgsTable/ArgRow.stories.tsx and 1 other location - About 2 hrs to fix
      lib/components/src/blocks/ArgsTable/ArgRow.stories.tsx on lines 184..196

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

      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 writeCsf = async (csf: CsfFile, fileName?: string) => {
        const fname = fileName || csf._fileName;
        if (!fname) throw new Error('Please specify a fileName for writeCsf');
        await fs.writeFile(fileName, await formatCsf(csf));
      };
      Severity: Major
      Found in lib/csf-tools/src/CsfFile.ts and 1 other location - About 2 hrs to fix
      lib/csf-tools/src/ConfigFile.ts on lines 233..237

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

      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

              this.setState(call.storyId, (state) => ({
                callRefsByResult: new Map([
                  ...Array.from(state.callRefsByResult.entries()),
                  [e, { __callId__: call.id, retain: call.retain }],
                ]),
      Severity: Major
      Found in lib/instrumenter/src/instrumenter.ts and 1 other location - About 2 hrs to fix
      lib/instrumenter/src/instrumenter.ts on lines 462..467

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

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

      export const getComponentInputsOutputs = (component: any): ComponentInputsOutputs => {
        const componentMetadata = getComponentDecoratorMetadata(component);
        const componentPropsMetadata = getComponentPropsDecoratorMetadata(component);
      
        const initialValue: ComponentInputsOutputs = {

        Function handleADD has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function handleADD(node, parent, storiesOfIdentifiers) {
          if (!node.property || !node.property.name || node.property.name !== 'add') {
            return {};
          }
        
        
        Severity: Minor
        Found in lib/source-loader/src/abstract-syntax-tree/parse-helpers.js - About 1 hr to fix

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

          const run = async () => {
            const allExamples = await readdir(p(['examples']));
          
            // if a specific example is passed, use it. Else use all
            let examplesToBuild =
          Severity: Minor
          Found in scripts/build-storybooks.js - About 1 hr to fix

            Function collapseAllStories has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const collapseAllStories = (stories: StoriesHash) => {
              // keep track of component IDs that have been rewritten to the ID of their first leaf child
              const componentIdToLeafId: Record<string, string> = {};
            
              // 1) remove all leaves
            Severity: Minor
            Found in lib/ui/src/components/sidebar/data.ts - About 1 hr to fix

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

              interface JsonFunctionValueState {
                value: JsonFunctionValueProps['value'];
                name: JsonFunctionValueProps['name'];
                keyPath: string[];
                deep: JsonFunctionValueProps['deep'];
              lib/components/src/controls/react-editable-json-tree/JsonNodes.tsx on lines 1397..1404

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

              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 JsonValueState {
                value: JsonValueProps['value'];
                name: JsonValueProps['name'];
                keyPath: string[];
                deep: JsonValueProps['deep'];
              lib/components/src/controls/react-editable-json-tree/JsonNodes.tsx on lines 496..503

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

              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 generateDefault({ name, raw }: DocgenFlowType): PropType {
                if (raw != null) {
                  return !isTooLongForTypeSummary(raw) ? createSummaryValue(raw) : createSummaryValue(name, raw);
                }
              
              
              Severity: Major
              Found in addons/docs/src/lib/docgen/flow/createType.ts and 1 other location - About 1 hr to fix
              addons/docs/src/lib/docgen/flow/createType.ts on lines 58..64

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

              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

              describe('getControlSetterButtonId', () => {
                it.each([
                  // caseName, input, expected
                  ['lower case', 'some-id', 'set-some-id'],
                  ['upper case', 'SOME-ID', 'set-SOME-ID'],
              Severity: Major
              Found in lib/components/src/controls/helpers.test.ts and 1 other location - About 1 hr to fix
              lib/components/src/controls/helpers.test.ts on lines 3..12

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

              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