rescribet/link-redux

View on GitHub

Showing 41 of 111 total issues

Function useResourceLinks has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function useResourceLinks<
  T extends MapDataToPropsParam = {},
  D extends LinkOpts = TermOpts,
>(
  subjects: LaxNode | Node[],
Severity: Minor
Found in src/hooks/useResourceLinks.ts - About 1 hr to fix

    Function normalizeDataSubjects has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    export function normalizeDataSubjects(props: Partial<DataInvalidationProps>): SubjectType[] {
        if (!(props.subject || props.dataSubjects)) {
            return NO_SUBJECTS;
        }
    
    
    Severity: Minor
    Found in src/hooks/useDataInvalidation.ts - About 55 mins 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 useRenderLoadingOrError has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export function useRenderLoadingOrError(
      props: TypableProps & TypableInjectedProps,
      error?: Error,
    ): React.ReactElement<any> | null | undefined {
        const lrs = useLRS();
    Severity: Minor
    Found in src/hooks/useLoadingOrError.ts - About 45 mins 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 calculate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    const calculate = (
      subject: Node,
      resource: LaxIdentifier | LaxIdentifier[] | Query,
      fields: Query | null,
    ): TargetTuple => {
    Severity: Minor
    Found in src/hooks/makeParsedField/useTargetedQuery.ts - About 35 mins 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 orderedElementsOfList has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    export function orderedElementsOfList(store: LinkedRenderStore<any>, listEntry: Node): NestedBoundData {
      const list = [];
      const nodes = [listEntry];
      let next = listEntry;
      while (next && next !== rdfx.nil) {
    Severity: Minor
    Found in src/hooks/makeParsedField/iterables.ts - About 35 mins 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 targetsChanged has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    export const targetsChanged = (previous: Targets, next: Targets): boolean => {
      if (previous === next) {
        return false;
      }
    
    
    Severity: Minor
    Found in src/hooks/makeParsedField/useTargetedQuery/targetsChanged.ts - About 35 mins 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 createConnectedComponent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    const createConnectedComponent = <P>(
      propMap: DataToPropsMapping,
      opts: LinkOpts,
      wrappedComponent: React.ComponentType<P>,
    ) => React.forwardRef((props: P & PropertyWrappedProps, ref: React.Ref<unknown>) => {
    Severity: Minor
    Found in src/hocs/link/wrapWithConnect.ts - About 35 mins 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 useCalculatedViewWithState has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    function useCalculatedViewWithState(
        props: InjectedPropTypes,
        lrs: LinkReduxLRSType,
        error?: Error,
    ): React.ReactElement | null {
    Severity: Minor
    Found in src/components/Resource.tsx - About 35 mins 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 toJS has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    function toJS(obj: Literal | unknown): ToJSOutputTypes {
        if (!isLiteral(obj)) {
            return obj as object;
        }
    
    
    Severity: Minor
    Found in src/hocs/link/toReturnType.ts - About 35 mins 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

    Avoid too many return statements within this function.
    Open

        return !equals(previous, next);
    Severity: Major
    Found in src/hooks/makeParsedField/useTargetedQuery/queryChanged.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

        return !equals(previous, next);
      Severity: Major
      Found in src/hooks/makeParsedField/useTargetedQuery/targetsChanged.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return Number(obj.value);
        Severity: Major
        Found in src/hocs/link/toReturnType.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return true;
          Severity: Major
          Found in src/hooks/makeParsedField/useTargetedQuery/queryChanged.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return null;
            Severity: Major
            Found in src/components/Property.tsx - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return propertyRenderer(
                          renderChildrenOrValue(childProps, lrs),
                          associationRenderer,
                      );
              Severity: Major
              Found in src/components/Property.tsx - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return arrayResolver(lrs, query);
                Severity: Major
                Found in src/hooks/makeParsedField/Query.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return propertyRenderer(wrapLOC, associationRenderer);
                  Severity: Major
                  Found in src/components/Property.tsx - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return obj.value;
                    Severity: Major
                    Found in src/hocs/link/toReturnType.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return React.createElement(associationRenderer, associationProps, childComp);
                      Severity: Major
                      Found in src/components/Property.tsx - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                            return undefined;
                        Severity: Major
                        Found in src/hooks/useLoadingOrError.ts - About 30 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language