exadel-inc/esl

View on GitHub

Showing 7 of 23 total issues

Function printFiles has a Cognitive Complexity of 17 (exceeds 10 allowed). Consider refactoring.
Open

function printFiles(fileStat, basePath) {
let text = '';
for (const file of fileStat) {
text += `### ${file.filepath}\n`;
text += `<table>\n`;
Severity: Minor
Found in packages/snapshot-tests/src/reporters/printers.js - About 1 hr to fix

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 {
Severity: Minor
Found in packages/esl/src/esl-utils/async/debounce.ts - About 1 hr to fix

    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');
    Severity: Minor
    Found in packages/esl/src/esl-utils/dom/script.ts - About 1 hr to fix

      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> {
      Severity: Minor
      Found in packages/esl/src/esl-utils/decorators/decorate.ts - About 1 hr to fix

        Function attr has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
        Open

        export const attr = <T = string>(config: AttrDescriptor<T> = {}): ESLAttributeDecorator => {
        return (target: ESLDomElementTarget, propName: string): any => {
        const attrName = buildAttrName(config.name || propName, !!config.dataAttr);
        const inheritAttrName = typeof config.inherit === 'string' ? config.inherit : attrName;
         
         
        Severity: Minor
        Found in packages/esl/src/esl-utils/decorators/attr.ts - About 55 mins to fix

        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) {
        Severity: Minor
        Found in packages/esl/src/esl-utils/misc/object/path.ts - About 35 mins to fix

        Function _onKeyDown has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
        Open

        @listen({event: 'keydown', target: document})
        protected _onKeyDown(e: KeyboardEvent): void | boolean {
        if (!this.current || e.key !== TAB) return;
         
        if (this.current.a11y === 'none' || this.current.a11y === 'autofocus') return;
        Severity: Minor
        Found in packages/esl/src/esl-toggleable/core/esl-toggleable-manager.ts - About 25 mins to fix
        Severity
        Category
        Status
        Source
        Language