rescribet/link-redux

View on GitHub

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";
Severity: Major
Found in src/hooks/__tests__/useParsedField.spec.tsx - About 1 day to fix

    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,
    Severity: Major
    Found in src/__tests__/helpers/fixtures.ts - About 3 hrs to fix

      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;
        }
      
      
      Severity: Minor
      Found in src/hooks/makeParsedField/useTargetedQuery/queryChanged.ts - About 2 hrs to fix

      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 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;
        }
      Severity: Minor
      Found in src/hooks/makeParsedField/Query.ts - About 2 hrs to fix

      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";
      Severity: Minor
      Found in src/__tests__/helpers/fixtures.ts - About 2 hrs to fix

        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>,
        >(
        Severity: Major
        Found in src/hooks/useManyLinkedObjectProperties.ts - About 2 hrs to fix

          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,
          Severity: Minor
          Found in src/types.ts - About 2 hrs to fix

            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)) {
            Severity: Major
            Found in src/components/Property.tsx - About 2 hrs to fix

              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),
              Severity: Minor
              Found in src/__tests__/helpers/fixtures.ts - About 1 hr to fix

                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 };
                
                
                Severity: Minor
                Found in src/components/Property/useChildPropsOrFallback.ts - About 1 hr to fix

                  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)) {
                  Severity: Minor
                  Found in src/components/Property.tsx - About 1 hr to fix

                  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 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;
                      }
                  Severity: Minor
                  Found in src/hooks/makeParsedField/Query.ts - About 1 hr to fix

                  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;
                    }
                  
                  
                  Severity: Minor
                  Found in src/hooks/makeParsedField/useTargetedQuery/queryChanged.ts - About 1 hr to fix

                    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> {
                    Severity: Minor
                    Found in src/hooks/useCalculateChildProps.ts - About 1 hr to fix

                      Function UpdateComp has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          const UpdateComp = () => {
                            const props = useResourceLink(
                              opts.subject,
                              {
                                creation: schema.dateCreated,
                      Severity: Minor
                      Found in src/hooks/__tests__/useResourceLink.spec.tsx - About 1 hr to fix

                        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();
                        
                        
                        Severity: Minor
                        Found in src/hooks/useDataInvalidation.ts - About 1 hr to fix

                          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 };
                          
                          
                          Severity: Minor
                          Found in src/components/Property/useChildPropsOrFallback.ts - About 1 hr to fix

                          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> {
                          Severity: Minor
                          Found in src/hooks/useCalculateChildProps.ts - About 1 hr to fix

                          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[],
                          Severity: Minor
                          Found in src/hooks/useTempRecords.ts - About 1 hr to fix

                            Function exceptResolver has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              (s: Identifier | undefined) => {
                              if (s === undefined) {
                                return NESTED_EMPTY_ARRAY;
                              }
                            
                            
                            Severity: Minor
                            Found in src/hooks/makeParsedField/Query.ts - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language