fbredius/storybook

View on GitHub
addons/docs/src/blocks/Story.tsx

Summary

Maintainability
B
4 hrs
Test Coverage

Function Story has 73 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Story: FunctionComponent<StoryProps> = (props) => {
  const context = useContext(DocsContext);
  const channel = addons.getChannel();
  const storyRef = useRef();
  const storyId = getStoryId(props, context);
Severity: Major
Found in addons/docs/src/blocks/Story.tsx - About 2 hrs to fix

    Function Story has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    const Story: FunctionComponent<StoryProps> = (props) => {
      const context = useContext(DocsContext);
      const channel = addons.getChannel();
      const storyRef = useRef();
      const storyId = getStoryId(props, context);
    Severity: Minor
    Found in addons/docs/src/blocks/Story.tsx - About 55 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function getStoryProps has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    export const getStoryProps = <TFramework extends AnyFramework>(
      { height, inline }: StoryProps,
      story: StoryType<TFramework>,
      context: DocsContextProps<TFramework>,
      onStoryFnCalled: () => void
    Severity: Minor
    Found in addons/docs/src/blocks/Story.tsx - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    block is empty
    Open

            showError: () => {},
    Severity: Minor
    Found in addons/docs/src/blocks/Story.tsx by tslint

    Rule: no-empty

    Disallows empty blocks.

    Blocks with a comment inside are not considered empty.

    Rationale

    Empty blocks are often indicators of missing code.

    Config

    If allow-empty-catch is specified, then catch blocks are allowed to be empty. If allow-empty-functions is specified, then function definitions are allowed to be empty.

    Examples
    "no-empty": true
    "no-empty": true,allow-empty-catch
    "no-empty": true,allow-empty-functions
    "no-empty": true,allow-empty-catch,allow-empty-functions
    Schema
    {
      "type": "array",
      "items": {
        "anyOf": [
          {
            "type": "string",
            "enum": [
              "allow-empty-catch"
            ]
          },
          {
            "type": "string",
            "enum": [
              "allow-empty-functions"
            ]
          }
        ]
      }
    }

    For more information see this page.

    block is empty
    Open

            showException: () => {},
    Severity: Minor
    Found in addons/docs/src/blocks/Story.tsx by tslint

    Rule: no-empty

    Disallows empty blocks.

    Blocks with a comment inside are not considered empty.

    Rationale

    Empty blocks are often indicators of missing code.

    Config

    If allow-empty-catch is specified, then catch blocks are allowed to be empty. If allow-empty-functions is specified, then function definitions are allowed to be empty.

    Examples
    "no-empty": true
    "no-empty": true,allow-empty-catch
    "no-empty": true,allow-empty-functions
    "no-empty": true,allow-empty-catch,allow-empty-functions
    Schema
    {
      "type": "array",
      "items": {
        "anyOf": [
          {
            "type": "string",
            "enum": [
              "allow-empty-catch"
            ]
          },
          {
            "type": "string",
            "enum": [
              "allow-empty-functions"
            ]
          }
        ]
      }
    }

    For more information see this page.

    block is empty
    Open

            showMain: () => {},
    Severity: Minor
    Found in addons/docs/src/blocks/Story.tsx by tslint

    Rule: no-empty

    Disallows empty blocks.

    Blocks with a comment inside are not considered empty.

    Rationale

    Empty blocks are often indicators of missing code.

    Config

    If allow-empty-catch is specified, then catch blocks are allowed to be empty. If allow-empty-functions is specified, then function definitions are allowed to be empty.

    Examples
    "no-empty": true
    "no-empty": true,allow-empty-catch
    "no-empty": true,allow-empty-functions
    "no-empty": true,allow-empty-catch,allow-empty-functions
    Schema
    {
      "type": "array",
      "items": {
        "anyOf": [
          {
            "type": "string",
            "enum": [
              "allow-empty-catch"
            ]
          },
          {
            "type": "string",
            "enum": [
              "allow-empty-functions"
            ]
          }
        ]
      }
    }

    For more information see this page.

    There are no issues that match your filters.

    Category
    Status