fbredius/storybook

View on GitHub
lib/channels/src/index.ts

Summary

Maintainability
A
25 mins
Test Coverage

Function emit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  emit(eventName: string, ...args: any) {
    const event: ChannelEvent = { type: eventName, args, from: this.sender };
    let options = {};
    if (args.length >= 1 && args[0] && args[0].options) {
      options = args[0].options;
Severity: Minor
Found in lib/channels/src/index.ts - About 25 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

Interface has only a call signature — use type Listener = (...args: any[]) => void; instead.
Open

  (...args: any[]): void;
Severity: Minor
Found in lib/channels/src/index.ts by tslint

Rule: callable-types

An interface or literal type with just a call signature can be written as a function type.

Rationale

style

Notes
  • TypeScript Only
  • Has Fix

Config

Not configurable.

For more information see this page.

There are no issues that match your filters.

Category
Status