Showing 17 of 36 total issues
File api.spec.ts
has 508 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable @typescript-eslint/no-unused-vars */
import * as sinon from "sinon";
import { IEventRoot, IEventsItem } from "./model";
import { assert, use as chaiUse } from "chai";
import { url, urlParams } from "./requestHelper";
File data-tools.ts
has 444 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {
IBaseStationRoot,
IElementRoot,
IEndnodesItem,
IEventRoot,
Function reduceTestData
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function reduceTestData(
baseStations: IBaseStationRoot,
elementRoot: IElementRoot,
eventRoot: IEventRoot,
) {
Function tryStripPersonalDataFromBaseStation
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
function tryStripPersonalDataFromBaseStation(
baseStations: IBaseStationRoot,
maps: IPersonalDataMaps,
) {
for (const base of baseStations) {
- Read upRead up
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 reduceTestData
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export function reduceTestData(
baseStations: IBaseStationRoot,
elementRoot: IElementRoot,
eventRoot: IEventRoot,
) {
- Read upRead up
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 tryStripPersonalDataFromEvents
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function tryStripPersonalDataFromEvents(
events: IEventsItem[],
maps: IPersonalDataMaps,
) {
for (const event of events) {
- Read upRead up
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 mergeEventRoots
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
function mergeEventRoots(
eventRoots: IEventRoot[],
baseStationRoots: IBaseStationRoot[],
mergedBaseStationRoot: IBaseStationRoot,
elementRoots: IElementRoot[],
Function mergeElementsRoots
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function mergeElementsRoots(elementRoots: IElementRoot[]) {
const mergedElementsRoot = elementRoots[0];
for (let i = 1; i < elementRoots.length; i++) {
const currentElementRoot = elementRoots[i];
// bs01
- Read upRead up
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 tryStripPersonalDataFromEvents
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function tryStripPersonalDataFromEvents(
events: IEventsItem[],
maps: IPersonalDataMaps,
) {
for (const event of events) {
Function tryStripPersonalDataAndGiveUniqueIds
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function tryStripPersonalDataAndGiveUniqueIds(
baseStations: IBaseStationRoot,
elementRoot: IElementRoot,
eventRoot: IEventRoot,
): void {
Function tryStripPersonalDataFromRooms
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function tryStripPersonalDataFromRooms(
objectWithRoomData: unknown,
maps: IPersonalDataMaps,
) {
const item = objectWithRoomData as ISubelementsItem;
- Read upRead up
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 runTests
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function runTests(method: "get" | "post") {
const reply1 = {};
const reply2 = { alpha: 1, beta: "2" };
const reply3 = { m: "NO" };
const scope = nock(url)
Function mergeTestData
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function mergeTestData(
baseStationRoots: IBaseStationRoot[],
elementRoots: IElementRoot[],
eventRoots: IEventRoot[],
): [IBaseStationRoot, IElementRoot, IEventRoot] {
Function Authorize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function Authorize(
target: GigasetElementsApi,
title: string,
descriptor: PropertyDescriptor,
) {
- Read upRead up
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
Avoid deeply nested control flow statements. Open
for (const setting of settings) {
if (setting.endnode_id)
setting.endnode_id = maps.elementIds.get(
setting.endnode_id,
) as string;
Function mergeEventRoots
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
eventRoots: IEventRoot[],
baseStationRoots: IBaseStationRoot[],
mergedBaseStationRoot: IBaseStationRoot,
elementRoots: IElementRoot[],
mergedElementRoots: IElementRoot,
Function mergeBaseStationRoots
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function mergeBaseStationRoots(baseStationRoots: IBaseStationRoot[]) {
const mergedBaseStationRoot = baseStationRoots[0];
for (let i = 1; i < baseStationRoots.length; i++) {
const currentBaseStationRoot = baseStationRoots[i];
for (let j = 0; j < baseStationRoots[i].length; j++) {
- Read upRead up
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"