rescribet/link-lib

View on GitHub

Showing 69 of 153 total issues

Function processDelta has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public processDelta(delta: Array<Quadruple|void>): Quadruple[] {
        for (const s of delta) {
            const subj = s ? s[0] : undefined;

            if (!s || !equals(s[QuadPosition.graph], ll.meta)) {
Severity: Minor
Found in src/processor/DataProcessor.ts - About 1 hr to fix

    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 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: RDFAdapter,
                                  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 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

      Function mineForTypes has a Cognitive Complexity of 12 (exceeds 5 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

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

      export function processObject(subject: Node,
                                    predicate: NamedNode,
                                    datum: DataObject | SerializableDataTypes | null | undefined,
                                    store: RDFAdapter,
                                    ns?: NamespaceMap): NamedBlobTuple[] {
      Severity: Minor
      Found in src/processor/DataToGraph.ts - About 1 hr to fix

        Function handleStatus has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        async function handleStatus(res: ResponseAndFallbacks): Promise<ResponseAndFallbacks> {
            if (res.status === NOT_FOUND) {
                throw {
                    message: `404: '${getURL(res)}' could not be found`,
                    res,
        Severity: Minor
        Found in src/processor/DataProcessor.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 toGraph has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        export function toGraph(
            iriOrData: SomeNode | DataObject,
            data?: DataObject,
            store?: RDFAdapter,
            ns?: NamespaceMap,
        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 fieldReferences has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        export const fieldReferences = (values: FieldValue, referenced: Id): boolean => {
          if (Array.isArray(values)) {
            for (const value of values) {
              if (value.termType !== TermType.Literal && value.value === referenced) {
                return true;
        Severity: Minor
        Found in src/store/StructuredStore/references.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 11 (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 match has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          public match(
            aSubject: SomeNode | null,
            aPredicate: NamedNode | null,
            aObject: SomeTerm | null,
            justOne: boolean = false,
        Severity: Minor
        Found in src/store/RDFAdapter.ts - About 1 hr to fix

          Function processStatement has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              processStatement(
                  recordId: Id,
                  field: Id,
                  value: SomeTerm,
                  ctx: VocabularyProcessingContext,
          Severity: Minor
          Found in src/schema/rdfs.ts - About 1 hr to fix

            Function expandProperty has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            export function expandProperty(prop: NamedNode | Term | string | undefined,
                                           namespaces: NamespaceMap = {}): NamedNode | undefined {
                if (!prop) {
                    return prop as undefined;
                }
            Severity: Minor
            Found in src/utilities/memoizedNamespace.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 buildSlice has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const buildSlice = (creator: SliceCreator): DataSlice => {
              if (creator === undefined) {
                throw new Error("No creator passed");
              }
            
            
            Severity: Minor
            Found in src/datastrucures/DataSliceDSL.ts - About 1 hr to fix

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

                  public queueDelta(delta: Quadruple[]): void {
                      this.deltas.push(delta);
                      const store = this.store.getInternalStore().store;
                      const llNS = ll.ns("").value;
                      const ldNS = ld.ns("").value;
              Severity: Minor
              Found in src/processor/DataProcessor.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 contentTypeByMimeString has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              export function contentTypeByMimeString(contentType: string, ext: string): string | undefined {
                  if (contentType.includes(F_NTRIPLES) || contentType.includes(F_NTRIPLES_DEP)) {
                      return F_NTRIPLES;
                  } else if (contentType.includes(F_PLAIN) && ["ntriples", "nt"].indexOf(ext) >= 0) {
                      return F_NTRIPLES;
              Severity: Minor
              Found in src/utilities/responses.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 processStatement has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  processStatement(
                      recordId: Id,
                      field: Id,
                      value: SomeTerm,
                      ctx: VocabularyProcessingContext,
              Severity: Minor
              Found in src/schema/rdfs.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 getEntities has a Cognitive Complexity of 9 (exceeds 5 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 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 createProcessRDF has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              export const createProcessRDF = (rdfParse: RDFLibParse): (response: ResponseAndFallbacks) => Promise<Quadruple[]> => {
                  return async function processRDF(response: ResponseAndFallbacks): Promise<Quadruple[]> {
                      let data: string;
                      if (isRdfLibResponse(response)) {
                          data = response.responseText;
              Severity: Minor
              Found in src/transformers/rdf-formats-common.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 getContentType has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              export function getContentType(res: ResponseAndFallbacks): string {
                  const contentTypeRaw = getHeader(res, "Content-Type");
                  if (contentTypeRaw === undefined || contentTypeRaw === null) {
                      return "";
                  }
              Severity: Minor
              Found in src/utilities/responses.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

              Severity
              Category
              Status
              Source
              Language