OpenHPS/openhps-rdf

View on GitHub

Showing 62 of 157 total issues

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

    convertSingleValue(
        sourceObject: any,
        typeDescriptor: TypeDescriptor,
        memberName: string,
        memberOptions?: ObjectMemberMetadata,
Severity: Major
Found in src/rdf/InternalRDFSerializer.ts - About 2 hrs to fix

    Function generateComparisonSelector has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected generateComparisonSelector<T>(
            selector: string,
            subquery: QuerySelector<T>,
            predicate: IriString,
            dataType: Serializable<any>,
    Severity: Major
    Found in src/service/SPARQLGenerator.ts - About 2 hrs to fix

      Function createInsert has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          createInsert(object: T): string {
              const changelog = RDFSerializer.serializeToChangeLog(object, {
                  baseUri: this.baseUri,
              });
              const generator = new SparqlGenerator();
      Severity: Minor
      Found in src/service/SPARQLGenerator.ts - About 1 hr to fix

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

            convertSingleValue(
                sourceObject: any,
                typeDescriptor: TypeDescriptor,
                memberName: string,
                memberOptions?: ObjectMemberMetadata,
        Severity: Minor
        Found in src/rdf/InternalRDFSerializer.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 createDelete has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            createDelete(id: IriString): string {
                const generator = new SparqlGenerator();
                const identifierMember = RDFSerializer.getUriMetadata(this.dataType);
                const query: SparqlQuery = {
                    type: 'update',
        Severity: Minor
        Found in src/service/SPARQLGenerator.ts - About 1 hr to fix

          Function convertSingleValue has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              convertSingleValue(
                  sourceObject: any,
                  typeDescriptor: TypeDescriptor,
                  knownTypes: Map<string, Serializable<any>>,
                  memberName = 'object',
          Severity: Minor
          Found in src/rdf/InternalRDFDeserializer.ts - About 1 hr to fix

            Function delete has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                delete(
                    predicate: IriString,
                    object: Quad_Object | Thing | number | string | IriString | object,
                    languageOrDatatype?: string | IriString,
                ): RDFBuilder {
            Severity: Minor
            Found in src/rdf/RDFBuilder.ts - About 1 hr to fix

              Function externals has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  externals: function (_, request, callback) {
                    const knownExternals = {
                      '@openhps/core': {
                        module: "./openhps-core.es" + (env.prod ? ".min" : "") + ".js",
                        commonjs: '@openhps/core',
              Severity: Minor
              Found in webpack.config.js - About 1 hr to fix

                Function deserializer has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    deserializer: (object: any) => {
                        if (!object) {
                            return undefined;
                        }
                
                
                Severity: Minor
                Found in src/mapping/DataObject.ts - About 1 hr to fix

                  Function deserializeMap has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      deserializeMap(
                          sourceObject: Quad_Object[],
                          typeDescriptor: MapTypeDescriptor,
                          knownTypes: Map<string, Serializable<any>>,
                          memberName: string,
                  Severity: Minor
                  Found in src/rdf/InternalRDFDeserializer.ts - About 1 hr to fix

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

                        deserializeObject<T>(
                            sourceObject: Thing,
                            typeDescriptor: TypeDescriptor,
                            knownTypes: Map<string, Serializable<any>>,
                            _: string,
                    Severity: Minor
                    Found in src/rdf/InternalRDFDeserializer.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 createChangeLog has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function createChangeLog(store: Store): Store & RDFChangeLog {
                        // Add a changelog to the store
                        (store as any).additions = [];
                        (store as any).deletions = [];
                    
                    
                    Severity: Minor
                    Found in src/rdf/ChangeLog.ts - About 1 hr to fix

                      Function createDeleteAll has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          createDeleteAll(query: FilterQuery<T>): string {
                              const generator = new SparqlGenerator();
                              const sparqlQuery: SparqlQuery = {
                                  type: 'update',
                                  prefixes: {
                      Severity: Minor
                      Found in src/service/SPARQLGenerator.ts - About 1 hr to fix

                        Function processClass has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            static processClass(nodeType: any): Promise<[string, string]> {
                                return new Promise((resolve, reject) => {
                                    const url = `https://openhps.org/terms/procedure/${nodeType.name}`;
                                    const builder = RDFBuilder.namedNode(url as IriString)
                                        .add(rdfs.label, nodeType.name, "en");
                        Severity: Minor
                        Found in src/bin/ProjectGenerator.ts - About 1 hr to fix

                          Function add has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              add(
                                  predicate: IriString,
                                  object: Quad_Object | Thing | number | string | IriString | object,
                                  languageOrDatatype?: string | IriString,
                              ): RDFBuilder {
                          Severity: Minor
                          Found in src/rdf/RDFBuilder.ts - About 1 hr to fix

                            Function fetchRemoteData has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            async function fetchRemoteData(url: string, namespace: string): Promise<Quad[]> {
                                const response = await axios.get(url, {
                                    headers: {
                                        'Accept': 'text/turtle;q=0.9, application/rdf+xml;q=0.8',
                                    },
                            Severity: Minor
                            Found in src/bin/generateNamespaceTs.ts - About 1 hr to fix

                              Function get has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      get: (obj: Store & RDFChangeLog, prop) => {
                                          switch (prop) {
                                              case 'add':
                                                  return (quad: Quad) => {
                                                      obj.add(quad);
                              Severity: Minor
                              Found in src/rdf/ChangeLog.ts - About 1 hr to fix

                                Function buildProject has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    static buildProject(directory: string, options: ProjectBuildOptions = {}): Promise<number> {
                                        return new Promise((resolve, reject) => {
                                            // Prepare directories
                                            if (fs.existsSync(directory)) {
                                                fs.rmSync(directory, { recursive: true });
                                Severity: Minor
                                Found in src/bin/ProjectGenerator.ts - About 1 hr to fix

                                  Function deserializePredicates has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                          function deserializePredicates(predicates: any) {
                                              return Object.keys(predicates)
                                                  .map((predicate: any) => {
                                                      return {
                                                          [predicate]: predicates[predicate].map((item: any) => {
                                  Severity: Minor
                                  Found in src/mapping/DataObject.ts - About 1 hr to fix

                                    Function serializer has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                            serializer: (node: Node<any, any>, baseUri: IriString) => {
                                                if (!(node instanceof ProcessingNode)) {
                                                    return undefined;
                                                }
                                    
                                    
                                    Severity: Minor
                                    Found in src/mapping/Node.ts - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language