litleleprikon/socket-io-vscode

View on GitHub
src/SocketIOEventsTreeProvider.ts

Summary

Maintainability
A
55 mins
Test Coverage

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

    public getChildren(element?: SocketIOEventsItem | SocketIOEventsCollectionItem | SocketIOConnectionItem):
        Array<SocketIOEventsItem | SocketIOEventsCollectionItem | SocketIOConnectionItem> {
        if (!element) {
            const elements: SocketIOConnectionItem[] = [];
            for (const connection of this.collector.connections()) {
Severity: Minor
Found in src/SocketIOEventsTreeProvider.ts - 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

Array type using 'Array<t>' is forbidden. Use 'T[]' instead.</t>
Open

        Array<SocketIOEventsItem | SocketIOEventsCollectionItem | SocketIOConnectionItem> {
Severity: Minor
Found in src/SocketIOEventsTreeProvider.ts by tslint

Rule: array-type

Requires using either 'T[]' or 'Array<t>' for arrays.</t>

Notes
  • TypeScript Only
  • Has Fix

Config

One of the following arguments must be provided:

  • "array" enforces use of T[] for all types T.
  • "generic" enforces use of Array<T> for all types T.
  • "array-simple" enforces use of T[] if T is a simple type (primitive or type reference).
Examples
"array-type": true,array
"array-type": true,generic
"array-type": true,array-simple
Schema
{
  "type": "string",
  "enum": [
    "array",
    "generic",
    "array-simple"
  ]
}

For more information see this page.

There are no issues that match your filters.

Category
Status