OpenHPS/openhps-rdf

View on GitHub

Showing 52 of 207 total issues

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

                protected generateComparisonSelector<T>(
                    selector: string,
                    subquery: QuerySelector<T>,
                    predicate: IriString,
                    dataType: Serializable<any>,
            Severity: Minor
            Found in src/service/SPARQLGenerator.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 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 generateArraySelector has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected generateArraySelector<T>(
                        selector: string,
                        subquery: QuerySelector<T>,
                        predicate: IriString,
                        dataType: Serializable<any>,
                Severity: Minor
                Found in src/service/SPARQLGenerator.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, application/rdf+xml, text/html',
                          },
                  Severity: Minor
                  Found in src/bin/generateNamespaceTs.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 add has 30 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 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

                          Function objectPatterns has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                          ).map((predicate) => {
                                              const patterns: Pattern[] = [];
                                              const selectorPatterns = this.generateSelector(query, predicate, dataType, member, subject);
                                              if (selectorPatterns.length > 0) {
                                                  patterns.push(...selectorPatterns);
                          Severity: Minor
                          Found in src/service/SPARQLGenerator.ts - About 1 hr to fix

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

                                    deserializer: (thing: Thing) => {
                                        let yaw = 0;
                                        let roll = 0;
                                        let pitch = 0;
                                        let unit: AngleUnit;
                            Severity: Minor
                            Found in src/mapping/RelativeOrientation.ts - About 1 hr to fix

                              Function loadClasses has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  protected static loadClasses(module: NodeModule = require.main): void {
                                      if (module === undefined) {
                                          // Use cache instead
                                          Object.values(require.cache).map((m) => this.loadClasses(m));
                                          return;
                              Severity: Minor
                              Found in src/rdf/RDFModelSerializer.ts - About 1 hr to fix

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

                                        serializer: (pos: GeographicalPosition) => {
                                            if (pos.altitude) {
                                                return {
                                                    predicates: {
                                                        [ogc.asWKT]: [
                                Severity: Minor
                                Found in src/mapping/GeographicalPosition.ts - About 1 hr to fix

                                  Function regexPatterns has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                                      (predicate) => {
                                                          return [
                                                              {
                                                                  type: 'bgp',
                                                                  triples: [
                                  Severity: Minor
                                  Found in src/service/SPARQLGenerator.ts - About 1 hr to fix

                                    Function deserializer has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                            deserializer: (thing: Thing) => {
                                                let yaw = 0;
                                                let roll = 0;
                                                let pitch = 0;
                                                let unit: AngleUnit;
                                    Severity: Minor
                                    Found in src/mapping/RelativeOrientation.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 serializer has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        serializer: (rdf: RDFMetadata) => {
                                            if (!rdf) {
                                                return undefined;
                                            }
                                    
                                    
                                    Severity: Minor
                                    Found in src/mapping/DataObject.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