Showing 69 of 153 total issues
File LinkedRenderStore.ts
has 490 lines of code (exceeds 250 allowed). Consider refactoring. Open
import rdfFactory, {
isNode,
isQuad,
NamedNode,
Node,
File DataProcessor.ts
has 473 lines of code (exceeds 250 allowed). Consider refactoring. Open
import rdfFactory, { isNode, NamedNode, QuadPosition, Quadruple, TermType } from "@ontologies/core";
import * as ld from "@ontologies/ld";
import * as rdf from "@ontologies/rdf";
import * as schema from "@ontologies/schema";
import * as xsd from "@ontologies/xsd";
LinkedRenderStore
has 38 functions (exceeds 20 allowed). Consider refactoring. Open
export class LinkedRenderStore<T, API extends LinkedDataAPI = DataProcessor> implements Dispatcher {
public static registerRenderer<T>(
component: T,
type: LazyNNArgument,
prop: LazyNNArgument = RENDER_CLASS_NAME,
File DataProcessor.spec.ts
has 358 lines of code (exceeds 250 allowed). Consider refactoring. Open
import "../../__tests__/useFactory";
import rdfFactory, { NamedNode, Quadruple } from "@ontologies/core";
import * as ld from "@ontologies/ld";
import * as rdfx from "@ontologies/rdf";
File StructuredStore.spec.ts
has 346 lines of code (exceeds 250 allowed). Consider refactoring. Open
import rdfFactory, { createNS, NamedNode, Quadruple } from "@ontologies/core";
import * as rdf from "@ontologies/rdf";
import * as rdfs from "@ontologies/rdfs";
import * as schema from "@ontologies/schema";
Function broadcast
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
private broadcast(buffer = true, maxTimeout = 1000): Promise<void> {
if (maxTimeout !== 0 && this.currentBroadcast || this.broadcastHandle) {
return this.currentBroadcast || Promise.resolve();
}
- 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 createMessageProcessor
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const createMessageProcessor = (lrs: LinkedRenderStore<unknown>): ((m: Messages) => void) => {
const store = lrs.store.getInternalStore().store;
return (message: Messages): void => {
switch (message.type) {
File RDFStore.spec.ts
has 289 lines of code (exceeds 250 allowed). Consider refactoring. Open
import "jest";
import "./useFactory";
import rdfFactory, { createNS, NamedNode, QuadPosition, Quadruple } from "@ontologies/core";
import * as owl from "@ontologies/owl";
Function match
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public match(
aSubject: SomeNode | null,
aPredicate: NamedNode | null,
aObject: SomeTerm | null,
justOne: boolean = false,
- 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
DataProcessor
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
export class DataProcessor implements LinkedDataAPI, DeltaProcessor {
public accept: { [k: string]: string };
private _dispatch?: MiddlewareActionHandler;
private readonly bulkEndpoint: string;
RDFStore
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
export class RDFStore implements DeltaProcessor {
public langPrefs: string[] = Array.from(typeof navigator !== "undefined"
? (navigator.languages || [navigator.language])
: ["en"]);
private changedResources: Set<string> = new Set();
Function execActionByIRI
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public async execActionByIRI(subject: NamedNode, dataTuple: DataTuple): Promise<LinkedActionResponse> {
const [graph, blobs = []] = dataTuple;
if (this.store.getInternalStore().store.getRecord(subject.value) === 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 broadcast
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
private broadcast(buffer = true, maxTimeout = 1000): Promise<void> {
if (maxTimeout !== 0 && this.currentBroadcast || this.broadcastHandle) {
return this.currentBroadcast || Promise.resolve();
}
Function execActionByIRI
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async execActionByIRI(subject: NamedNode, dataTuple: DataTuple): Promise<LinkedActionResponse> {
const [graph, blobs = []] = dataTuple;
if (this.store.getInternalStore().store.getRecord(subject.value) === undefined) {
Function processDelta
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public processDelta(delta: Array<Quadruple|void>): Quadruple[] {
for (const s of delta) {
const subj = s ? s[0] : undefined;
if (!s || !equals(s[QuadPosition.graph], ll.meta)) {
- 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 queue
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private queue(idleCallback?: IdleDeadline | number): void {
if (this.timeout !== 0 && this.hasIdleCallback) {
while (typeof idleCallback === "object"
&& (!this.done() && (idleCallback.timeRemaining() > 0 || idleCallback.didTimeout))) {
this.process();
- 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 getEntity
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async getEntity(iri: NamedNode, opts?: APIFetchOpts): Promise<Quadruple[]> {
const url = new URL(iri.value);
url.hash = "";
const requestIRI = rdfFactory.namedNode(url.toString());
const existing = this.requestMap.get(requestIRI.id);
Function deltaProcessor
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const deltaProcessor = (
addGraphIRIS: NamedNode[],
replaceGraphIRIS: NamedNode[],
removeGraphIRIS: NamedNode[],
purgeGraphIRIS: NamedNode[],
Function getSortedFieldMembers
has a Cognitive Complexity of 14 (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 mineForTypes
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public mineForTypes(lookupTypes: string[]): string[] {
if (lookupTypes.length === 0) {
return [rdfs.Resource.value];
}