rescribet/link-lib

View on GitHub

Showing 139 of 139 total issues

Function getRenderComponent has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public getRenderComponent(
        types: Id[],
        fields: Id[],
        topology: Id,
        defaultType: Id,
Severity: Minor
Found in src/ComponentStore/ComponentStore.ts - About 1 hr to fix

    Function deltaProcessor has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const deltaProcessor = (
        addGraphIRIS: NamedNode[],
        replaceGraphIRIS: NamedNode[],
        removeGraphIRIS: NamedNode[],
        purgeGraphIRIS: NamedNode[],
    Severity: Minor
    Found in src/store/deltaProcessor.ts - About 1 hr to fix

      Function queue has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          private queue(idleCallback?: IdleDeadline | number): void {
              if (this.timeout !== 0 && this.hasIdleCallback) {
                  while (typeof idleCallback === "object"
                      && (!this.done() && (idleCallback.timeRemaining() > 0 || idleCallback.didTimeout))) {
                      this.process();
      Severity: Minor
      Found in src/ProcessBroadcast.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 getEntity has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public async getEntity(iri: NamedNode, opts?: APIFetchOpts): Promise<Quadruple[]> {
              const url = new URL(iri.value);
              url.hash = "";
              const requestIRI = rdfFactory.namedNode(url.toString());
              const existing = this.requestMap.get(requestIRI.id);
      Severity: Minor
      Found in src/processor/DataProcessor.ts - About 1 hr to fix

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

                it("rejects for client errors", async () => {
                    const store = getBasicStore();
        
                    const res = new Response(null, { status: BAD_REQUEST });
                    expect(store.processor.processExternalResponse(res)).rejects.toBeTruthy();
        Severity: Major
        Found in src/processor/__tests__/DataProcessor.spec.ts and 2 other locations - About 1 hr to fix
        src/processor/__tests__/DataProcessor.spec.ts on lines 395..400
        src/processor/__tests__/DataProcessor.spec.ts on lines 409..414

        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 71.

        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("rejects for server errors", async () => {
                    const store = getBasicStore();
        
                    const res = new Response(null, { status: INTERNAL_SERVER_ERROR });
                    expect(store.processor.processExternalResponse(res)).rejects.toBeTruthy();
        Severity: Major
        Found in src/processor/__tests__/DataProcessor.spec.ts and 2 other locations - About 1 hr to fix
        src/processor/__tests__/DataProcessor.spec.ts on lines 395..400
        src/processor/__tests__/DataProcessor.spec.ts on lines 402..407

        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 71.

        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("rejects for not-found responses", async () => {
                    const store = getBasicStore();
        
                    const res = new Response(null, { status: NOT_FOUND });
                    expect(store.processor.processExternalResponse(res)).rejects.toBeTruthy();
        Severity: Major
        Found in src/processor/__tests__/DataProcessor.spec.ts and 2 other locations - About 1 hr to fix
        src/processor/__tests__/DataProcessor.spec.ts on lines 402..407
        src/processor/__tests__/DataProcessor.spec.ts on lines 409..414

        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 71.

        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 processDelta has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public processDelta(delta: Array<Quadruple|void>): Quadruple[] {
                let s: Quadruple|void;
                for (let i = 0, len = delta.length; i < len; i++) {
                    s = delta[i];
                    const subj = s ? s[0] : undefined;
        Severity: Minor
        Found in src/processor/DataProcessor.ts - About 1 hr to fix

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

                  it("handles null", () => {
                      const g = new RDFIndex();
                      processObject(example.ns("a"), example.ns("property"), null, g);
                      expect(g.quads).toHaveLength(0);
                  });
          Severity: Major
          Found in src/processor/__tests__/DataToGraph.spec.ts and 1 other location - About 1 hr to fix
          src/processor/__tests__/DataToGraph.spec.ts on lines 231..235

          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 68.

          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 undefined", () => {
                      const g = new RDFIndex();
                      processObject(example.ns("a"), example.ns("property"), null, g);
                      expect(g.quads).toHaveLength(0);
                  });
          Severity: Major
          Found in src/processor/__tests__/DataToGraph.spec.ts and 1 other location - About 1 hr to fix
          src/processor/__tests__/DataToGraph.spec.ts on lines 237..241

          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 68.

          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 mineForTypes has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public mineForTypes(lookupTypes: string[]): string[] {
                  if (lookupTypes.length === 0) {
                      return [rdfs.Resource.value];
                  }
          
          
          Severity: Minor
          Found in src/Schema.ts - About 1 hr to fix

            Function processObject has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

            export function processObject(subject: Node,
                                          predicate: NamedNode,
                                          datum: DataObject | SerializableDataTypes | null | undefined,
                                          store: RDFIndex,
                                          ns?: NamespaceMap): NamedBlobTuple[] {
            Severity: Minor
            Found in src/processor/DataToGraph.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 quadsForRecord has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

              public quadsForRecord(recordId: Id): Quadruple[] {
                const factory = this.rdfFactory;
                const record = this.store.getRecord(recordId);
            
                if (record === undefined) {
            Severity: Minor
            Found in src/store/RDFAdapter.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 linkedDeltaProcessor has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

            export function linkedDeltaProcessor(lrs: LinkedRenderStore<any>): ResponseTransformer {
                return async function processLinkedDelta(response: ResponseAndFallbacks): Promise<Quadruple[]> {
                    let data: string;
                    if (response instanceof Response) {
                        data = response.bodyUsed ? "" : await response.text();
            Severity: Minor
            Found in src/transformers/linked-delta.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 getEntities has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public getEntities(resources: ResourceQueueItem[]): Promise<Quadruple[]> {
                    const reload: NamedNode[] = [];
            
                    const toBeFetched = new Set<NamedNode>();
            
            
            Severity: Minor
            Found in src/processor/DataProcessor.ts - About 1 hr to fix

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

              export const thingStatements: Quadruple[] = [
                  [schemaT, rdf.type, rdfs.Class, defaultGraph],
                  [schemaT, rdfs.comment, rdfFactory.literal("The most generic type of item."), defaultGraph],
                  [schemaT, rdfs.label, rdfFactory.literal("Thing."), defaultGraph],
              ];
              Severity: Major
              Found in src/__tests__/LinkedRenderStore/fixtures.ts and 2 other locations - About 1 hr to fix
              src/__tests__/RDFStore.spec.ts on lines 22..26
              src/store/__tests__/StructuredStore.spec.ts on lines 16..20

              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 66.

              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("returns the first content-type", () => {
                          const response = {
                              body: "",
                              headers: {"Content-Type": "text/html; application/xhtml+xml"},
                              requestedURI: "http://example.com/",
              Severity: Major
              Found in src/utilities/__tests__/responses.spec.ts and 2 other locations - About 1 hr to fix
              src/utilities/__tests__/responses.spec.ts on lines 59..67
              src/utilities/__tests__/responses.spec.ts on lines 69..77

              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 66.

              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

              const thingStatements: Quadruple[] = [
                  [schemaT, rdf.type, rdfs.Class, defaultGraph],
                  [schemaT, rdfs.comment, rdfFactory.literal("The most generic type"), defaultGraph],
                  [schemaT, rdfs.label, rdfFactory.literal("Thing."), defaultGraph],
              ];
              Severity: Major
              Found in src/store/__tests__/StructuredStore.spec.ts and 2 other locations - About 1 hr to fix
              src/__tests__/LinkedRenderStore/fixtures.ts on lines 16..20
              src/__tests__/RDFStore.spec.ts on lines 22..26

              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 66.

              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("returns the content-type for known values", () => {
                          const response = {
                              body: "",
                              headers: {"Content-Type": "application/rdf+xml; text/xml; application/xml"},
                              requestedURI: "http://example.com/",
              Severity: Major
              Found in src/utilities/__tests__/responses.spec.ts and 2 other locations - About 1 hr to fix
              src/utilities/__tests__/responses.spec.ts on lines 59..67
              src/utilities/__tests__/responses.spec.ts on lines 79..87

              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 66.

              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("returns the content-type for known extensions", () => {
                          const response = {
                              body: "",
                              headers: {"Content-Type": "*/*"},
                              requestedURI: "http://example.com/test.ttl",
              Severity: Major
              Found in src/utilities/__tests__/responses.spec.ts and 2 other locations - About 1 hr to fix
              src/utilities/__tests__/responses.spec.ts on lines 69..77
              src/utilities/__tests__/responses.spec.ts on lines 79..87

              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 66.

              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