rescribet/link-redux

View on GitHub

Showing 111 of 111 total issues

Similar blocks of code found in 3 locations. Consider refactoring.
Open

  it("renders langstrings", () => {
    const opts = ctx.fullCW();

    const UpdateComp = () => {
      const [text] = useStrings(schema.text);
Severity: Major
Found in src/hooks/__tests__/useStrings.spec.tsx and 2 other locations - About 4 hrs to fix
src/hooks/__tests__/useStrings.spec.tsx on lines 9..25
src/hooks/__tests__/useStrings.spec.tsx on lines 45..61

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 129.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

  it("filters non-strings", () => {
    const opts = ctx.fullCW();

    const UpdateComp = () => {
      const [dateCreated] = useStrings(schema.dateCreated);
Severity: Major
Found in src/hooks/__tests__/useStrings.spec.tsx and 2 other locations - About 4 hrs to fix
src/hooks/__tests__/useStrings.spec.tsx on lines 9..25
src/hooks/__tests__/useStrings.spec.tsx on lines 27..43

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 129.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    it("renders default when set", () => {
        const opts = ctx.fullCW();
        opts.lrs.registerAll(LinkedRenderStore.registerRenderer(
            createComponent("thing"),
            schema.Thing,
Severity: Major
Found in src/components/__tests__/Type.spec.ts and 1 other location - About 3 hrs to fix
src/components/__tests__/Type.spec.ts on lines 60..70

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 110.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    it("renders the registered class", () => {
        const opts = ctx.fullCW();
        opts.lrs.registerAll(LinkedRenderStore.registerRenderer(
            createComponent("creativeWork"),
            schema.CreativeWork,
Severity: Major
Found in src/components/__tests__/Type.spec.ts and 1 other location - About 3 hrs to fix
src/components/__tests__/Type.spec.ts on lines 48..58

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 110.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

          it("unpacks circular List", () => {
            const { wrapper } = ctx.fullCW();
            const { result: { current } } = renderHook(() => useValues(array(example.ns("circular"))), { wrapper });
    
            expect(current).toEqual(["c0", "c1"]);
    Severity: Major
    Found in src/hooks/__tests__/useParsedField.spec.tsx and 2 other locations - About 3 hrs to fix
    src/hooks/__tests__/useParsedField.spec.tsx on lines 404..409
    src/hooks/__tests__/useParsedField.spec.tsx on lines 411..416

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 100.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

          it("unpacks endless List", () => {
            const { wrapper } = ctx.fullCW();
            const { result: { current } } = renderHook(() => useValues(array(example.ns("endless"))), { wrapper });
    
            expect(current).toEqual(["e0", "e1"]);
    Severity: Major
    Found in src/hooks/__tests__/useParsedField.spec.tsx and 2 other locations - About 3 hrs to fix
    src/hooks/__tests__/useParsedField.spec.tsx on lines 404..409
    src/hooks/__tests__/useParsedField.spec.tsx on lines 418..423

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 100.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

          it("unpacks broken List", () => {
            const { wrapper } = ctx.fullCW();
            const { result: { current } } = renderHook(() => useValues(array(example.ns("broken"))), { wrapper });
    
            expect(current).toEqual(["b0", "b1"]);
    Severity: Major
    Found in src/hooks/__tests__/useParsedField.spec.tsx and 2 other locations - About 3 hrs to fix
    src/hooks/__tests__/useParsedField.spec.tsx on lines 411..416
    src/hooks/__tests__/useParsedField.spec.tsx on lines 418..423

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 100.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

          describe("useDates", () => {
            const result = [new Date(dateLiteral.value)];
    
            it("returns a parsed value", () => {
              const value = renderHook(() => useDates(prop), { wrapper });
    Severity: Major
    Found in src/hooks/__tests__/useParsedField.spec.tsx and 1 other location - About 2 hrs to fix
    src/hooks/__tests__/useParsedField.spec.tsx on lines 628..636

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 91.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

          describe("useUrls", () => {
            const result = [new URL(globalId.value)];
    
            it("returns a parsed value", () => {
              const value = renderHook(() => useUrls(prop), { wrapper });
    Severity: Major
    Found in src/hooks/__tests__/useParsedField.spec.tsx and 1 other location - About 2 hrs to fix
    src/hooks/__tests__/useParsedField.spec.tsx on lines 565..573

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 91.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    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;
      }
    
    
    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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

            it("handles long equal array", () => {
              const id1 = rdfFactory.blankNode();
              const id2 = rdfFactory.blankNode();
              const id3 = rdfFactory.blankNode();
              expect(hasChanged([id1, id2, id3], [id1, id2, id3])).toBeFalsy();
      Severity: Major
      Found in src/hooks/__tests__/useCalculatedValue.spec.ts and 1 other location - About 2 hrs to fix
      src/hooks/__tests__/useCalculatedValue.spec.ts on lines 29..34

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 82.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

            it("handles long unequal array", () => {
              const id1 = rdfFactory.blankNode();
              const id2 = rdfFactory.blankNode();
              const id3 = rdfFactory.blankNode();
              expect(hasChanged([id1, id2, id3], [id2, id1, id3])).toBeTruthy();
      Severity: Major
      Found in src/hooks/__tests__/useCalculatedValue.spec.ts and 1 other location - About 2 hrs to fix
      src/hooks/__tests__/useCalculatedValue.spec.ts on lines 22..27

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 82.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              describe("data fetching", () => {
                it("has dereference", () => expect(dereference(schema.name))
                  .toHaveProperty("fetch", true));
                it("has hold", () => expect(hold(schema.name))
                  .toHaveProperty("fetch", false));
            Severity: Major
            Found in src/__tests__/dsl.spec.ts and 1 other location - About 2 hrs to fix
            src/__tests__/dsl.spec.ts on lines 87..92

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 77.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              describe("rendering", () => {
                it("has force", () => expect(renderAlways(schema.name))
                  .toHaveProperty("forceRender", true));
                it("has partial", () => expect(renderPartial(schema.name))
                  .toHaveProperty("forceRender", false));
            Severity: Major
            Found in src/__tests__/dsl.spec.ts and 1 other location - About 2 hrs to fix
            src/__tests__/dsl.spec.ts on lines 80..85

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 77.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Severity
            Category
            Status
            Source
            Language