rescribet/link-lib

View on GitHub

Showing 69 of 153 total issues

File LinkedRenderStore.ts has 490 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import rdfFactory, {
    isNode,
    isQuad,
    NamedNode,
    Node,
Severity: Minor
Found in src/LinkedRenderStore.ts - About 7 hrs to fix

    File DataProcessor.ts has 473 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import rdfFactory, { isNode, NamedNode, QuadPosition, Quadruple, TermType } from "@ontologies/core";
    import * as ld from "@ontologies/ld";
    import * as rdf from "@ontologies/rdf";
    import * as schema from "@ontologies/schema";
    import * as xsd from "@ontologies/xsd";
    Severity: Minor
    Found in src/processor/DataProcessor.ts - About 7 hrs to fix

      LinkedRenderStore has 38 functions (exceeds 20 allowed). Consider refactoring.
      Open

      export class LinkedRenderStore<T, API extends LinkedDataAPI = DataProcessor> implements Dispatcher {
          public static registerRenderer<T>(
              component: T,
              type: LazyNNArgument,
              prop: LazyNNArgument = RENDER_CLASS_NAME,
      Severity: Minor
      Found in src/LinkedRenderStore.ts - About 5 hrs to fix

        File DataProcessor.spec.ts has 358 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import "../../__tests__/useFactory";
        
        import rdfFactory, { NamedNode, Quadruple } from "@ontologies/core";
        import * as ld from "@ontologies/ld";
        import * as rdfx from "@ontologies/rdf";
        Severity: Minor
        Found in src/processor/__tests__/DataProcessor.spec.ts - About 4 hrs to fix

          File StructuredStore.spec.ts has 346 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import rdfFactory, { createNS, NamedNode, Quadruple } from "@ontologies/core";
          import * as rdf from "@ontologies/rdf";
          import * as rdfs from "@ontologies/rdfs";
          import * as schema from "@ontologies/schema";
          
          
          Severity: Minor
          Found in src/store/__tests__/StructuredStore.spec.ts - About 4 hrs to fix

            Function broadcast has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
            Open

                private broadcast(buffer = true, maxTimeout = 1000): Promise<void> {
                    if (maxTimeout !== 0 && this.currentBroadcast || this.broadcastHandle) {
                        return this.currentBroadcast || Promise.resolve();
                    }
            
            
            Severity: Minor
            Found in src/LinkedRenderStore.ts - About 3 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 createMessageProcessor has 83 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const createMessageProcessor = (lrs: LinkedRenderStore<unknown>): ((m: Messages) => void) => {
              const store = lrs.store.getInternalStore().store;
            
              return (message: Messages): void => {
                switch (message.type) {
            Severity: Major
            Found in src/messages/messageProcessor.ts - About 3 hrs to fix

              File RDFStore.spec.ts has 289 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import "jest";
              import "./useFactory";
              
              import rdfFactory, { createNS, NamedNode, QuadPosition, Quadruple } from "@ontologies/core";
              import * as owl from "@ontologies/owl";
              Severity: Minor
              Found in src/__tests__/RDFStore.spec.ts - About 2 hrs to fix

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

                DataProcessor has 25 functions (exceeds 20 allowed). Consider refactoring.
                Open

                export class DataProcessor implements LinkedDataAPI, DeltaProcessor {
                    public accept: { [k: string]: string };
                
                    private _dispatch?: MiddlewareActionHandler;
                    private readonly bulkEndpoint: string;
                Severity: Minor
                Found in src/processor/DataProcessor.ts - About 2 hrs to fix

                  RDFStore has 23 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  export class RDFStore implements DeltaProcessor {
                      public langPrefs: string[] = Array.from(typeof navigator !== "undefined"
                          ? (navigator.languages || [navigator.language])
                          : ["en"]);
                      private changedResources: Set<string> = new Set();
                  Severity: Minor
                  Found in src/RDFStore.ts - About 2 hrs to fix

                    Function execActionByIRI has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public async execActionByIRI(subject: NamedNode, dataTuple: DataTuple): Promise<LinkedActionResponse> {
                    
                            const [graph, blobs = []] = dataTuple;
                    
                            if (this.store.getInternalStore().store.getRecord(subject.value) === undefined) {
                    Severity: Minor
                    Found in src/processor/DataProcessor.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 broadcast has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private broadcast(buffer = true, maxTimeout = 1000): Promise<void> {
                            if (maxTimeout !== 0 && this.currentBroadcast || this.broadcastHandle) {
                                return this.currentBroadcast || Promise.resolve();
                            }
                    
                    
                    Severity: Major
                    Found in src/LinkedRenderStore.ts - About 2 hrs to fix

                      Function execActionByIRI has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public async execActionByIRI(subject: NamedNode, dataTuple: DataTuple): Promise<LinkedActionResponse> {
                      
                              const [graph, blobs = []] = dataTuple;
                      
                              if (this.store.getInternalStore().store.getRecord(subject.value) === undefined) {
                      Severity: Major
                      Found in src/processor/DataProcessor.ts - About 2 hrs to fix

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

                          Function deltaProcessor has 46 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 getSortedFieldMembers has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                            Open

                            const getSortedFieldMembers = (record: DataRecord): MultimapTerm => {
                              const values: FieldValue = [];
                              const sortedEntries = Object
                                  .entries(record)
                                  .sort(([k1], [k2]) => {
                            Severity: Minor
                            Found in src/store/StructuredStore.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 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
                              Severity
                              Category
                              Status
                              Source
                              Language