File StructuredStore.ts
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
import rdfFactory, { SomeTerm } from "@ontologies/core";
import * as rdf from "@ontologies/rdf";
import * as rdfs from "@ontologies/rdfs";
import { SomeNode } from "../types";
Function withAlias
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public withAlias(previous: Id, current: Id): StructuredStore {
if (previous === current
|| this.aliases[previous] === current
|| this.aliases[current] === previous) {
return this;
Function getSortedFieldMembers
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const getSortedFieldMembers = (record: DataRecord): MultimapTerm => {
const values: FieldValue = [];
const sortedEntries = Object
.entries(record)
.sort(([k1], [k2]) => {
- 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 withAlias
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public withAlias(previous: Id, current: Id): StructuredStore {
if (previous === current
|| this.aliases[previous] === current
|| this.aliases[current] === previous) {
return this;
- 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 addField
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public addField(recordId: Id, field: FieldId, value: SomeTerm): boolean {
if (field === idField) {
throw new Error("Can't set system fields");
}
this.initializeRecord(recordId);
- 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 deleteFieldMatching
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public deleteFieldMatching(recordId: Id, field: FieldId, value: SomeTerm): void {
const current = this.getField(recordId, field);
if (current === undefined) {
return;
}
- 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 collectRecord
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public collectRecord(recordId: Id, collected: Id[] = []): DeepRecord | undefined {
const record = this.getRecord(recordId);
if (!record) { 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"