fbredius/storybook

View on GitHub

Showing 5,758 of 5,758 total issues

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

export const NoSidebar = ({ props }: { props: DesktopProps }) => (
  <Desktop {...props} options={{ ...props.options, showNav: false }} />
);
Severity: Major
Found in lib/ui/src/components/layout/desktop.stories.tsx and 2 other locations - About 1 hr to fix
lib/ui/src/components/layout/desktop.stories.tsx on lines 47..49
lib/ui/src/components/layout/desktop.stories.tsx on lines 53..55

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

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

                  <SearchResults
                    query={query}
                    results={results}
                    closeMenu={closeMenu}
                    getMenuProps={getMenuProps}
Severity: Major
Found in lib/ui/src/components/sidebar/Sidebar.tsx and 2 other locations - About 1 hr to fix
lib/ui/src/components/preview/preview.tsx on lines 86..95
lib/ui/src/components/sidebar/Refs.tsx on lines 161..170

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

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

  'span.align-center': {
    display: 'block',
    overflow: 'hidden',
    clear: 'both',

Severity: Major
Found in lib/components/src/typography/DocumentWrapper.tsx and 1 other location - About 1 hr to fix
lib/components/src/typography/elements/Span.tsx on lines 29..44

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

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

            <Tree
              isBrowsing={isBrowsing}
              isMain={isMain}
              refId={refId}
              data={stories}
Severity: Major
Found in lib/ui/src/components/sidebar/Refs.tsx and 2 other locations - About 1 hr to fix
lib/ui/src/components/preview/preview.tsx on lines 86..95
lib/ui/src/components/sidebar/Sidebar.tsx on lines 162..171

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

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

  'span.align-right': {
    display: 'block',
    overflow: 'hidden',
    clear: 'both',

Severity: Major
Found in lib/components/src/typography/DocumentWrapper.tsx and 1 other location - About 1 hr to fix
lib/components/src/typography/elements/Span.tsx on lines 45..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 63.

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

  '&.align-right': {
    display: 'block',
    overflow: 'hidden',
    clear: 'both',

Severity: Major
Found in lib/components/src/typography/elements/Span.tsx and 1 other location - About 1 hr to fix
lib/components/src/typography/DocumentWrapper.tsx on lines 259..275

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

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

    api.addDecorator = (decorator: DecoratorFunction<TFramework>) => {
      if (hasAdded)
        throw new Error(`You cannot add a decorator after the first story for a kind.
Read more here: https://github.com/storybookjs/storybook/blob/master/MIGRATION.md#can-no-longer-add-decoratorsparameters-after-stories`);

Severity: Major
Found in lib/client-api/src/ClientApi.ts and 1 other location - About 1 hr to fix
lib/client-api/src/ClientApi.ts on lines 383..388

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

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

  render() {
    return html`
      <header>
        <div class="wrapper">
          <div>
Severity: Minor
Found in examples/web-components-kitchen-sink/src/components/sb-header.ts - About 1 hr to fix

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

    const run = async () => {
      const port = await freePort(program.port);
      logger.log(`🌏 found a open port: ${port}`);
    
      const verdaccioUrl = `http://localhost:${port}`;
    Severity: Minor
    Found in scripts/run-registry.ts - About 1 hr to fix

      Function vnodeToString has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function vnodeToString(vnode: Vue.VNode): string {
        const attrString = [
          ...(vnode.data?.slot ? ([['slot', vnode.data.slot]] as [string, any][]) : []),
          ['class', stringifyClassAttribute(vnode)],
          ...(vnode.componentOptions?.propsData ? Object.entries(vnode.componentOptions.propsData) : []),
      Severity: Minor
      Found in addons/docs/src/frameworks/vue/sourceDecorator.ts - About 1 hr to fix

        Function ControlsPanel has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const ControlsPanel: FC = () => {
          const [args, updateArgs, resetArgs] = useArgs();
          const rows = useArgTypes();
          const isArgsStory = useParameter<boolean>('__isArgsStory', false);
          const {
        Severity: Minor
        Found in addons/controls/src/ControlsPanel.tsx - About 1 hr to fix

          Function VisionSimulator has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const VisionSimulator: FunctionComponent = () => {
            const [filter, setFilter] = useState<Filter>(null);
          
            return (
              <>
          Severity: Minor
          Found in addons/a11y/src/components/VisionSimulator.tsx - About 1 hr to fix

            Function collapseDocsOnlyStories has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const collapseDocsOnlyStories = (storiesHash: StoriesHash) => {
              // keep track of component IDs that have been rewritten to the ID of their first leaf child
              const componentIdToLeafId: Record<string, string> = {};
              const docsOnlyStoriesRemoved = Object.values(storiesHash).filter((item) => {
                if (item.isLeaf && item.parameters && item.parameters.docsOnly) {
            Severity: Minor
            Found in lib/ui/src/components/sidebar/data.ts - About 1 hr to fix

              Function validateConfigurationFiles has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function validateConfigurationFiles(configDir: string) {
                const extensionsPattern = `{${Array.from(boost).join(',')}}`;
                const exists = (file: string) =>
                  !!glob.sync(path.resolve(configDir, `${file}${extensionsPattern}`)).length;
              
              
              Severity: Minor
              Found in lib/core-common/src/utils/validate-configuration-files.ts - About 1 hr to fix

                Function handleEvent has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  private handleEvent(rawEvent: MessageEvent): void {
                    try {
                      const { data } = rawEvent;
                      const { key, event, refId } = typeof data === 'string' && isJSON(data) ? parse(data) : data;
                
                
                Severity: Minor
                Found in lib/channel-postmessage/src/index.ts - About 1 hr to fix

                  Function generator has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const generator: Generator = async (packageManager, npmOptions, options) => {
                    const extraMain = options.linkable
                      ? {
                          webpackFinal: `%%(config) => {
                        const path = require('path');
                  Severity: Minor
                  Found in lib/cli/src/generators/REACT_SCRIPTS/index.ts - About 1 hr to fix

                    Function keyToSymbol has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const keyToSymbol = (key: string): string => {
                      if (key === 'alt') {
                        return optionOrAltSymbol();
                      }
                      if (key === 'control') {
                    Severity: Minor
                    Found in lib/api/src/lib/shortcut.ts - About 1 hr to fix

                      Function checkWebpack5Builder has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        async checkWebpack5Builder(packageJson: PackageJsonWithDepsAndDevDeps) {
                          const { mainConfig, version: storybookVersion } = getStorybookInfo(packageJson);
                      
                          const storybookCoerced = storybookVersion && semver.coerce(storybookVersion)?.version;
                          if (!storybookCoerced) {
                      Severity: Minor
                      Found in lib/cli/src/automigrate/fixes/webpack5.ts - About 1 hr to fix

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

                        BorderUniform.args = {
                          render: (ref) => (
                            <div
                              ref={ref}
                              style={{
                        examples/official-storybook/stories/addon-measure/BoxModel.stories.js on lines 29..41
                        examples/official-storybook/stories/addon-measure/BoxModel.stories.js on lines 59..71

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

                        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

                        Narrow.args = {
                          render: (ref) => (
                            <div
                              ref={ref}
                              style={{
                        examples/official-storybook/stories/addon-measure/SmallNode.stories.js on lines 31..43
                        examples/official-storybook/stories/addon-measure/SmallNode.stories.js on lines 61..73

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

                        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