fbredius/storybook

View on GitHub

Showing 5,758 of 5,758 total issues

Function ArgsTable has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const ArgsTable: FC<ArgsTableProps> = (props) => {
  const context = useContext(DocsContext);
  const { id, storyById } = context;
  const {
    parameters: { controls },
Severity: Minor
Found in addons/docs/src/blocks/ArgsTable.tsx - About 1 hr to fix

    Function svelteDocgen has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default async function svelteDocgen(source: string) {
      // eslint-disable-next-line no-underscore-dangle
      const { resource } = this._module;
      const svelteOptions: any = { ...getOptions(this) };
    
    
    Severity: Minor
    Found in addons/docs/src/frameworks/svelte/svelte-docgen-loader.ts - About 1 hr to fix

      Function hookify has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function hookify<TFramework extends AnyFramework>(fn: AbstractFunction) {
        return (...args: any[]) => {
          const { hooks }: { hooks: HooksContext<TFramework> } =
            typeof args[0] === 'function' ? args[1] : args[0];
      
      
      Severity: Minor
      Found in lib/addons/src/hooks.ts - About 1 hr to fix

        Function useLastViewed has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const useLastViewed = (selection: Selection) => {
          const initialLastViewedStoryIds = useMemo((): StoryRef[] => {
            const items = store.get('lastViewedStoryIds');
            if (!items || !Array.isArray(items)) return [];
            if (!items.some((item) => typeof item === 'object' && item.storyId && item.refId)) return [];
        Severity: Minor
        Found in lib/ui/src/components/sidebar/useLastViewed.ts - About 1 hr to fix

          Function getSource has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const getSource = (
            withSource: SourceProps,
            expanded: boolean,
            setExpanded: Function
          ): SourceItem => {
          Severity: Minor
          Found in lib/components/src/blocks/Preview.tsx - About 1 hr to fix

            Function selectSpecifiedStory has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              async selectSpecifiedStory() {
                if (!this.urlStore.selectionSpecifier) {
                  this.renderMissingStory();
                  return;
                }
            Severity: Minor
            Found in lib/preview-web/src/PreviewWeb.tsx - About 1 hr to fix

              Function inferType has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const inferType = (value: any, name: string, visited: Set<any>): SBType => {
                const type = typeof value;
                switch (type) {
                  case 'boolean':
                  case 'string':
              Severity: Minor
              Found in lib/store/src/inferArgTypes.ts - About 1 hr to fix

                Function initModule has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  const initModule = () => {
                    // Sets `args` parameter in URL, omitting any args that have their initial value or cannot be unserialized safely.
                    const updateArgsParam = () => {
                      const { path, queryParams, viewMode } = fullAPI.getUrlState();
                      if (viewMode !== 'story') return;
                Severity: Minor
                Found in lib/api/src/modules/url.ts - About 1 hr to fix

                  Function useColorInput has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const useColorInput = (
                    initialValue: string | undefined,
                    onChange: (value: string) => string | void
                  ) => {
                    const [value, setValue] = useState(initialValue || '');
                  Severity: Minor
                  Found in lib/components/src/controls/Color.tsx - About 1 hr to fix

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

                        it('should load secondary story', () => {
                          cy.navigateToStory('example-button', 'secondary');
                          cy.getStoryElement()
                            .find('button')
                            .should('have.class', 'storybook-button')
                    Severity: Major
                    Found in cypress/generated/basic.spec.ts and 3 other locations - About 1 hr to fix
                    cypress/generated/basic.spec.ts on lines 14..20
                    cypress/generated/basic.spec.ts on lines 29..35
                    cypress/generated/basic.spec.ts on lines 36..42

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

                    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

                        it('should load large story', () => {
                          cy.navigateToStory('example-button', 'large');
                          cy.getStoryElement()
                            .find('button')
                            .should('have.class', 'storybook-button')
                    Severity: Major
                    Found in cypress/generated/basic.spec.ts and 3 other locations - About 1 hr to fix
                    cypress/generated/basic.spec.ts on lines 14..20
                    cypress/generated/basic.spec.ts on lines 22..28
                    cypress/generated/basic.spec.ts on lines 29..35

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

                    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

                    export class CustomPipePipe implements PipeTransform {
                      transform(value: any, args?: any): any {
                        return `CustomPipe: ${value}`;
                      }
                    }
                    examples/angular-cli/src/stories/core/moduleMetadata/angular-src/custom.pipe.ts on lines 6..10

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

                    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

                    export class CustomPipePipe implements PipeTransform {
                      transform(value: any, args?: any): any {
                        return `CustomPipe: ${value}`;
                      }
                    }
                    examples/angular-cli/src/stories/basics/component-with-pipe/custom.pipe.ts on lines 6..10

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

                    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

                    export const WithTooltip = (props: ComponentProps<typeof LazyWithTooltip>) => (
                      <Suspense fallback={<div />}>
                        <LazyWithTooltip {...props} />
                      </Suspense>
                    );
                    Severity: Major
                    Found in lib/components/src/tooltip/lazy-WithTooltip.tsx and 3 other locations - About 1 hr to fix
                    lib/components/src/controls/index.tsx on lines 12..16
                    lib/components/src/syntaxhighlighter/lazy-syntaxhighlighter.tsx on lines 5..9
                    lib/components/src/tooltip/lazy-WithTooltip.tsx on lines 17..21

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

                    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

                        it('should load primary story', () => {
                          cy.navigateToStory('example-button', 'primary');
                          cy.getStoryElement()
                            .find('button')
                            .should('have.class', 'storybook-button')
                    Severity: Major
                    Found in cypress/generated/basic.spec.ts and 3 other locations - About 1 hr to fix
                    cypress/generated/basic.spec.ts on lines 22..28
                    cypress/generated/basic.spec.ts on lines 29..35
                    cypress/generated/basic.spec.ts on lines 36..42

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

                    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

                        expect(outputStats).toHaveBeenCalledWith(
                          '/tmp/dir',
                          expect.objectContaining({ toJson: expect.any(Function) }),
                          expect.objectContaining({ toJson: expect.any(Function) })
                        );
                    Severity: Major
                    Found in lib/core-server/src/core-presets.test.ts and 1 other location - About 1 hr to fix
                    lib/core-server/src/core-presets.test.ts on lines 265..269

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

                    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

                        it('should load small story', () => {
                          cy.navigateToStory('example-button', 'small');
                          cy.getStoryElement()
                            .find('button')
                            .should('have.class', 'storybook-button')
                    Severity: Major
                    Found in cypress/generated/basic.spec.ts and 3 other locations - About 1 hr to fix
                    cypress/generated/basic.spec.ts on lines 14..20
                    cypress/generated/basic.spec.ts on lines 22..28
                    cypress/generated/basic.spec.ts on lines 36..42

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

                    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

                          this.setIframeBodyStyle({
                            width: `${scale * 100}%`,
                            height: `${scale * 100}%`,
                            transform: `scale(${1 / scale})`,
                            transformOrigin: 'top left',
                    Severity: Major
                    Found in lib/components/src/blocks/IFrame.tsx and 2 other locations - About 1 hr to fix
                    lib/components/src/Zoom/ZoomIFrame.tsx on lines 42..47
                    lib/components/src/Zoom/ZoomIFrame.tsx on lines 55..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 61.

                    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

                    const styleResets: CSSObject = {
                      // resets
                      appearance: 'none',
                      border: '0 none',
                      boxSizing: 'inherit',
                    Severity: Major
                    Found in lib/components/src/form/input/input.tsx and 1 other location - About 1 hr to fix
                    lib/components/src/controls/options/Select.tsx on lines 9..20

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

                    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

                    export const ColorControl = (props: ComponentProps<typeof LazyColorControl>) => (
                      <Suspense fallback={<div />}>
                        <LazyColorControl {...props} />
                      </Suspense>
                    );
                    Severity: Major
                    Found in lib/components/src/controls/index.tsx and 3 other locations - About 1 hr to fix
                    lib/components/src/syntaxhighlighter/lazy-syntaxhighlighter.tsx on lines 5..9
                    lib/components/src/tooltip/lazy-WithTooltip.tsx on lines 7..11
                    lib/components/src/tooltip/lazy-WithTooltip.tsx on lines 17..21

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

                    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