OpenHPS/openhps-rdf

View on GitHub

Showing 62 of 157 total issues

Function exports has 1198 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(variables) {
function getVariableValue(name) {
  if (!variables || !(name in variables)) {
    throw new Error('Undefined variable: ' + name);
  }
Severity: Major
Found in src/service/engine-default.js - About 5 days to fix

    File engine-default.js has 1200 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module.exports = function(variables) {
    function getVariableValue(name) {
      if (!variables || !(name in variables)) {
        throw new Error('Undefined variable: ' + name);
      }
    Severity: Major
    Found in src/service/engine-default.js - About 3 days to fix

      File SPARQLGenerator.ts has 702 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import {
          ArrayTypeDescriptor,
          DataSerializerUtils,
          FilterQuery,
          MapTypeDescriptor,
      Severity: Major
      Found in src/service/SPARQLGenerator.ts - About 1 day to fix

        Function generateComponent has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
        Open

            protected generateComponent(
                key: string,
                query: any,
                dataType: Serializable<any>,
                subject: Quad_Subject = DataFactory.variable('subject'),
        Severity: Minor
        Found in src/service/SPARQLGenerator.ts - About 7 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 generateComponent has 175 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected generateComponent(
                key: string,
                query: any,
                dataType: Serializable<any>,
                subject: Quad_Subject = DataFactory.variable('subject'),
        Severity: Major
        Found in src/service/SPARQLGenerator.ts - About 7 hrs to fix

          File InternalRDFDeserializer.ts has 444 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import {
              ArrayTypeDescriptor,
              DataSerializerUtils,
              Deserializer,
              DeserializerFn,
          Severity: Minor
          Found in src/rdf/InternalRDFDeserializer.ts - About 6 hrs to fix

            Function serializeObject has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
            Open

                serializeObject<T, TD extends TypeDescriptor>(
                    sourceObject: T,
                    typeDescriptor: TD,
                    _: string,
                    serializer: Serializer,
            Severity: Minor
            Found in src/rdf/InternalRDFSerializer.ts - About 6 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 serializeObject has 145 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                serializeObject<T, TD extends TypeDescriptor>(
                    sourceObject: T,
                    typeDescriptor: TD,
                    _: string,
                    serializer: Serializer,
            Severity: Major
            Found in src/rdf/InternalRDFSerializer.ts - About 5 hrs to fix

              Function bundle has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
              Open

              const bundle = (env, module, entry = 'index', suffix = '') => {
                const filename = `${PROJECT_NAME}${suffix}${module ? ".es" : ""}${env.prod ? ".min" : ""}`;
                return {
                  name: PROJECT_NAME,
                  entry: `./dist/esm5/${entry}.js`,
              Severity: Minor
              Found in webpack.config.js - About 5 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 deserializeObject has 133 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  deserializeObject<T>(
                      sourceObject: Thing,
                      typeDescriptor: TypeDescriptor,
                      knownTypes: Map<string, Serializable<any>>,
                      _: string,
              Severity: Major
              Found in src/rdf/InternalRDFDeserializer.ts - About 5 hrs to fix

                File InternalRDFSerializer.ts has 365 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import {
                    ArrayTypeDescriptor,
                    MapTypeDescriptor,
                    ObjectMemberMetadata,
                    ObjectMetadata,
                Severity: Minor
                Found in src/rdf/InternalRDFSerializer.ts - About 4 hrs to fix

                  Function generateArraySelector has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

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

                    Function createConstruct has 99 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected createConstruct(query: FilterQuery, dataType?: Serializable<T>): ConstructQuery {
                            const patterns: Pattern[] = [];
                            // Create a pattern for the datatype
                            const finalDataType = dataType || this.dataType;
                            if (finalDataType) {
                    Severity: Major
                    Found in src/service/SPARQLGenerator.ts - About 3 hrs to fix

                      Function delete has a Cognitive Complexity of 23 (exceeds 5 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 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 bundle has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const bundle = (env, module, entry = 'index', suffix = '') => {
                        const filename = `${PROJECT_NAME}${suffix}${module ? ".es" : ""}${env.prod ? ".min" : ""}`;
                        return {
                          name: PROJECT_NAME,
                          entry: `./dist/esm5/${entry}.js`,
                      Severity: Major
                      Found in webpack.config.js - About 3 hrs to fix

                        Function main has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function main() {
                            console.log(chalk.redBright('OpenHPS RDF Generator'));
                        
                            if (args['c']) {
                                const configPath = path.normalize(args['c']);
                        Severity: Major
                        Found in src/bin/cli.ts - About 2 hrs to fix

                          Function rdfTypeResolver has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                          Open

                              rdfTypeResolver(
                                  sourceObject: IndexedObject,
                                  knownTypes: Map<string, Serializable<any>>,
                                  knownRDFTypes: Map<IriString, string[]>,
                              ): Serializable<any> {
                          Severity: Minor
                          Found in src/rdf/InternalRDFDeserializer.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 deserializer has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                          Open

                              deserializer: (object: any) => {
                                  if (!object) {
                                      return undefined;
                                  }
                          
                          
                          Severity: Minor
                          Found in src/mapping/DataObject.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 add has a Cognitive Complexity of 18 (exceeds 5 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 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 rdfTypeResolver has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              rdfTypeResolver(
                                  sourceObject: IndexedObject,
                                  knownTypes: Map<string, Serializable<any>>,
                                  knownRDFTypes: Map<IriString, string[]>,
                              ): Serializable<any> {
                          Severity: Major
                          Found in src/rdf/InternalRDFDeserializer.ts - About 2 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language