File query.ts
has 415 lines of code (exceeds 250 allowed). Consider refactoring. Wontfix
import type { Fn2, Nullable, Predicate } from "@thi.ng/api";
import { isArray } from "@thi.ng/checks/is-array";
import { isFunction } from "@thi.ng/checks/is-function";
import { isSet } from "@thi.ng/checks/is-set";
import { compare } from "@thi.ng/compare/compare";
- Create a ticketCreate a ticket
Function ffn
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Wontfix
ffn: (res, db: any, s, p, _, opts) => {
if (opts.partial) {
for (let $s in db) {
if ((<FTerm>s)($s)) {
const sval = db[$s];
- Read upRead up
- Create a ticketCreate a ticket
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 querySP
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Wontfix
const querySP: QueryImpl = (res, sval: any, s, p, _, opts) => {
if (opts.partial) {
for (let q in sval) {
if ((<FTerm>p)(q)) {
const val = sval[q];
- Read upRead up
- Create a ticketCreate a ticket
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 query
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export const query = <T extends QueryObj = QueryObj>(
db: T[],
terms: Nullable<QueryTerm<T>>[],
opts: Partial<MultiQueryOpts<T>> = {}
) => {
- Read upRead up
- Create a ticketCreate a ticket
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 collectSO
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Wontfix
const collectSO = (
res: QueryObj,
sval: any,
s: SPTerm,
o: any,
- Read upRead up
- Create a ticketCreate a ticket
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 collectSP
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Wontfix
const collectSP = (
res: QueryObj,
sval: any,
s: SPTerm,
p: SPTerm,
- Read upRead up
- Create a ticketCreate a ticket
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 coerce
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const coerce = (x: any, isec = false) =>
isArray(x)
? isec
? intersect(x)
: (y: any) => x.includes(y)
- Read upRead up
- Create a ticketCreate a ticket
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
if ((<FTerm>p)($p)) {
collectFull(res, $s, sval);
break;
}
- Create a ticketCreate a ticket
Function coerceStr
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Wontfix
const coerceStr = (x: any) =>
isArray(x)
? coerce(x.map((y) => String(y)))
: isSet(x)
? coerce(new Set([...x].map((y) => String(y))))
- Read upRead up
- Create a ticketCreate a ticket
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 collect
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Wontfix
const collect = (
acc: any,
s: any,
p: any,
o: any,
- Read upRead up
- Create a ticketCreate a ticket
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 match
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Wontfix
const match = (o: any, val: any, opts: QueryOpts) => {
if (val != null) {
const pred = <Predicate<any>>(
(isFunction(o) ? o : ($: any) => opts.equiv(o, $))
);
- Read upRead up
- Create a ticketCreate a ticket
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 queryFL
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Wontfix
const queryFL: QueryImpl = (res, db: any, s, p, o, opts) => {
if (opts.partial) {
for (let $s in db) {
(<FTerm>s)($s) && collect(res, $s, p, o, db[$s]?.[<string>p], opts);
}
- Read upRead up
- Create a ticketCreate a ticket
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 nln
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Wontfix
nln: (res, db: any, _, p, __, opts) => {
if (opts.partial) {
for (let s in db) {
const val = db[s][<string>p];
val != null && addTriple(res, s, p, val);
- Read upRead up
- Create a ticketCreate a ticket
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 queryNL
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Wontfix
const queryNL: QueryImpl = (res, db: any, _, p, o, opts) => {
if (opts.partial) {
for (let s in db) {
collect(res, s, p, o, db[s][<string>p], opts);
}
- Read upRead up
- Create a ticketCreate a ticket
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"