Function _eval
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
function _eval(wgt: zk.Widget, s: string | null, args: unknown): string | null {
if (s)
for (var j = 0, k: number, l: number, t: string, last = s.length - 1, s2: string | undefined; ;) {
k = s.indexOf('#{', j);
if (k < 0) {
- 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 _create0
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
function _create0(parent: zk.Widget, e: HTMLElement, args: unknown, cwgts: zk.Widget[]): void {
var ifc = _eval(parent, e.getAttribute('if'), args),
unless = _eval(parent, e.getAttribute('unless'), args);
if ((ifc == null || ifc) && (unless == null || !unless)) {
var tn = e.tagName, wgt: zk.Widget;
- 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 _getPkgs0
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function _getPkgs0(e: HTMLElement, pkgmap: Record<string, unknown>): void {
var tn = e.tagName;
if ('zk' != tn && 'attribute' != tn) {
if (!zk.Widget.getClass(tn)) { //not register?
var clsnm = zk.wgt.WidgetInfo.getClassName(tn);
- 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 _create0
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _create0(parent: zk.Widget, e: HTMLElement, args: unknown, cwgts: zk.Widget[]): void {
var ifc = _eval(parent, e.getAttribute('if'), args),
unless = _eval(parent, e.getAttribute('unless'), args);
if ((ifc == null || ifc) && (unless == null || !unless)) {
var tn = e.tagName, wgt: zk.Widget;
Function _aftCreate
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function _aftCreate(wgt: zk.Widget | undefined, cwgts: zk.Widget[], node: HTMLElement, opts?: {replaceHTML?}): undefined | zk.Widget | zk.Widget[] {
let c: zk.Widget | undefined;
if (!wgt || !(c = wgt.firstChild))
return undefined;
- 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 _eval
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _eval(wgt: zk.Widget, s: string | null, args: unknown): string | null {
if (s)
for (var j = 0, k: number, l: number, t: string, last = s.length - 1, s2: string | undefined; ;) {
k = s.indexOf('#{', j);
if (k < 0) {
Avoid deeply nested control flow statements. Open
if (txt.trim().length) {
const w = new zk.Native();
w.prolog = txt;
wgt.appendChild(w);
} else if (wgt.blankPreserved)
Avoid deeply nested control flow statements. Open
if (s2) s = s2 + s.substring(j);