rescribet/link-redux

View on GitHub

Showing 20 of 39 total issues

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 useManyLinkedObjectProperties has 46 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: Minor
    Found in src/hooks/useManyLinkedObjectProperties.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 chargeLRS has 36 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 buildPropSets has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

        const buildPropSets = <D extends LinkOpts>(
          lrs: LinkReduxLRSType,
          dataSubjects: Array<Node | undefined>,
          requestedProperties: number[],
          opts: D,
        Severity: Minor
        Found in src/hooks/useResourceLinks.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 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: WithLinkCtxOptions = {},
        ): 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 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: WithLinkCtxOptions = {},
            ): 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 useChildPropsOrFallback has 27 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

              Avoid deeply nested control flow statements.
              Open

                            if (equals(subjProps[k].predicate, cur)) {
                              data.push(subjProps[k]);
                            }
              Severity: Major
              Found in src/hooks/useManyLinkedObjectProperties.ts - About 45 mins to fix

                Function limitTimes has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  props: P,
                  objRaw: SomeTerm[],
                  lrs: LinkReduxLRSType,
                  func: (prop: SomeTerm) => React.ReactNode,
                  associationRenderer: React.ComponentType<P>,
                Severity: Minor
                Found in src/components/Property/limitTimes.ts - About 35 mins to fix

                  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 {
                      const notReadyComponent = useRenderLoadingOrError(props, error);
                      const component = useResourceView(
                  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 useRenderLoadingOrError has a Cognitive Complexity of 7 (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 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 normalizeDataSubjects has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export function normalizeDataSubjects(props: Partial<DataInvalidationProps>): SubjectType[] {
                      if (!(props.subject || props.dataSubjects)) {
                          return [];
                      }
                  
                  
                  Severity: Minor
                  Found in src/hooks/useDataInvalidation.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 limitTimes(
                              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 limitTimes(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 null;
                        Severity: Major
                        Found in src/components/Property.tsx - 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

                            Function toJS has a Cognitive Complexity of 6 (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 25 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

                            Severity
                            Category
                            Status
                            Source
                            Language