Showing 11 of 52 total issues
Function MouseEvent
has a Cognitive Complexity of 33 (exceeds 10 allowed). Consider refactoring. Open
const MouseEvent = function (eventName: string, params: MouseEventInit): MouseEvent {
params = params || {};
const event: any = document.createEvent('MouseEvent');
// https://msdn.microsoft.com/en-us/library/ff975292(v=vs.85).aspx
- 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 KeyboardEvent
has a Cognitive Complexity of 21 (exceeds 10 allowed). Consider refactoring. Open
const KeyboardEvent = function (eventName: string, params: KeyboardEventInit): KeyboardEvent {
params = params || {};
const event: any = document.createEvent('KeyboardEvent');
// https://msdn.microsoft.com/en-us/library/ff975297(v=vs.85).aspx
- 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 fitOnMajorAxis
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function fitOnMajorAxis(cfg: PopupPositionConfig, rect: Rect): PositionType {
if (cfg.behavior !== 'fit' && cfg.behavior !== 'fit-on-major') return cfg.position;
let isMirrored = false;
const actionsToFit: Record<PositionType, () => void> = {
Function loadScript
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function loadScript(id: string, src: string, attrs: LoadScriptAttributes = {}): Promise<Event> {
return new Promise((resolve, reject) => {
const script: HTMLScriptElement =
(document.getElementById(id) || createScript(id, src, attrs)) as HTMLScriptElement;
const state = script.getAttribute('state');
Function debounce
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function debounce<F extends AnyToAnyFnSignature>(fn: F, wait = 10, thisArg?: object): Debounced<F> {
let timeout: number | null = null;
let deferred: Deferred<ReturnType<F>> | null = null;
function debouncedSubject(...args: any[]): void {
Function decorate
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function decorate<Args extends any[], Fn extends AnyToAnyFnSignature>(
decorator: (fn: Fn, ...params: Args) => Fn,
...args: Args
) {
return function (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<Fn>): TypedPropertyDescriptor<Fn> {
Function adjustAlignmentBySide
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function adjustAlignmentBySide(elCoord: number, outerCoord: number, arrowCoord: number, arrowLimit: number, isStartingSide: boolean): number {
Function fitOnMajorAxis
has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring. Open
function fitOnMajorAxis(cfg: PopupPositionConfig, rect: Rect): PositionType {
if (cfg.behavior !== 'fit' && cfg.behavior !== 'fit-on-major') return cfg.position;
let isMirrored = false;
const actionsToFit: Record<PositionType, () => void> = {
- 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 parseKeysPath
has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring. Open
const parseKeysPath = (path: string): PathKeyDef[] => {
let start = 0;
const parts: PathKeyDef[] = [];
while (start < path.length) {
- 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 FocusEvent
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
const FocusEvent = function (eventName: string, params: FocusEventInit): FocusEvent {
params = params || {};
const event: any = document.createEvent('FocusEvent');
// https://msdn.microsoft.com/en-us/library/ff975954(v=vs.85).aspx
- 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 assign
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
Object.assign = function assign(target: any, ...sources: any[]): any {
if (this instanceof Object.assign) throw new TypeError('Invoked as a constructor');
const to = toObject(target);
for (let i = 0; i < sources.length; i++) {
const nextSource = sources[i];
- 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"