Showing 41 of 111 total issues
File useParsedField.spec.tsx
has 501 lines of code (exceeds 250 allowed). Consider refactoring. Open
import rdfFactory, { NamedNode, QuadPosition, Quadruple } from "@ontologies/core";
import * as schema from "@ontologies/schema";
import { act, render } from "@testing-library/react";
import { renderHook } from "@testing-library/react-hooks";
import React from "react";
Function sFull
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
const sFull = (id: NamedNode, attrs: CWOpts = {}): Quadruple[] => {
const createQuad = (predicate: NamedNode, object: SomeTerm, graph = ld.add) => rdfFactory.quad(
id,
predicate,
object,
Function exceptResolver
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
const exceptResolver: Resolver<ExceptQuery> = (lrs: LinkReduxLRSType, query: ExceptQuery) =>
(s: Identifier | undefined) => {
if (s === undefined) {
return NESTED_EMPTY_ARRAY;
}
- 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 queryChanged
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
export const queryChanged = (previous: Query, next: Query) => {
if (previous === next) {
return 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
File fixtures.ts
has 266 lines of code (exceeds 250 allowed). Consider refactoring. Open
import rdfFactory, { NamedNode, Quad, Quadruple, SomeTerm } from "@ontologies/core";
import * as ld from "@ontologies/ld";
import * as rdfx from "@ontologies/rdf";
import * as schema from "@ontologies/schema";
import * as xsd from "@ontologies/xsd";
Function useManyLinkedObjectProperties
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function useManyLinkedObjectProperties<
T extends DataToPropsMapping = {},
D extends ReturnType = ReturnType.Term,
OutVal = LinkedDataObject<T, D>,
>(
File types.ts
has 255 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { BlankNode, Literal, NamedNode, Quadruple, SomeTerm, Term } from "@ontologies/core";
import {
DataProcessor,
DataRecord,
EmptyRequestStatus,
Function Property
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const Property: React.ComponentType<PropertyPropTypes & any> = (props): React.ReactElement<any> | null => {
const lrs = useLRS();
const childPropsOrFallback = useChildPropsOrFallback(props);
if (childPropsOrFallback === null || !Array.isArray(childPropsOrFallback)) {
Function chargeLRS
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function chargeLRS(delta: Quadruple[] = [], subject: SomeNode): TestContext<React.ComponentType<any>> {
const store = new RDFStore();
const s = new Schema(store);
const lrsOpts = {
mapping: new ComponentStoreTestProxy<React.ComponentType>(s),
Function useChildPropsOrFallback
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function useChildPropsOrFallback<P extends PropertyPropTypes>(props: P):
null | React.ReactElement | [CalculatedChildProps<P>, SomeTerm[]] {
const options = { topology: true };
Function arrayResolver
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const arrayResolver: Resolver<ArrayQuery> = (lrs: LinkReduxLRSType, query: ArrayQuery) =>
(target: Identifier | undefined) => {
if (target === undefined) {
return NESTED_EMPTY_ARRAY;
}
- 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 Property
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export const Property: React.ComponentType<PropertyPropTypes & any> = (props): React.ReactElement<any> | null => {
const lrs = useLRS();
const childPropsOrFallback = useChildPropsOrFallback(props);
if (childPropsOrFallback === null || !Array.isArray(childPropsOrFallback)) {
- 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 queryChanged
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const queryChanged = (previous: Query, next: Query) => {
if (previous === next) {
return false;
}
Function useCalculateChildProps
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function useCalculateChildProps<P, R = any>(
props: P & Partial<SubjectProp & TopologyProp & PassableRef<R>>,
context: LinkRenderContext,
options: UseCalculateChildPropsOptions = {},
): CalculatedChildProps<P> {
Function UpdateComp
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
const UpdateComp = () => {
const props = useResourceLink(
opts.subject,
{
creation: schema.dateCreated,
Function useDataInvalidation
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function useDataInvalidation(subjects: LaxIdentifier | LaxIdentifier[]): number {
const resources = normalizeType(subjects!).filter<Node>(Boolean as any).map((n) => n.value);
const memoizedResources = useMemoizedDataSubjects(resources);
const lrs = useLRS();
Function useChildPropsOrFallback
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export function useChildPropsOrFallback<P extends PropertyPropTypes>(props: P):
null | React.ReactElement | [CalculatedChildProps<P>, SomeTerm[]] {
const options = { topology: true };
- 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 useCalculateChildProps
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export function useCalculateChildProps<P, R = any>(
props: P & Partial<SubjectProp & TopologyProp & PassableRef<R>>,
context: LinkRenderContext,
options: UseCalculateChildPropsOptions = {},
): CalculatedChildProps<P> {
- 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 useTempRecords
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const useTempRecords = <T>(
items: T[],
fields: FieldSet | ItemFieldBuilder<T>,
deps: unknown[],
givenIds?: SomeNode[],
Function exceptResolver
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
(s: Identifier | undefined) => {
if (s === undefined) {
return NESTED_EMPTY_ARRAY;
}