ThinkDeepTech/thinkdeep

View on GitHub

Showing 104 of 104 total issues

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

  _commands(economicEntity) {
    if (!validEconomicEntities([economicEntity])) {
      throw new Error(
        `Economic entity was invalid. Received: ${economicEntity.toString()}`
      );
Severity: Minor
Found in packages/deep-microservice-collection/src/collection-service.js - About 1 hr to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        try {
          this._logger.debug(`Creating topics ${JSON.stringify(topics)}`);
          await this._admin.createTopics({
            /**
             * NOTE: If you don't wait for leaders the system throws an error when trying to write to the topic if a leader
    Severity: Major
    Found in packages/deep-microservice-analysis/src/analysis-service.js and 1 other location - About 1 hr to fix
    packages/deep-microservice-collection/src/collection-service.js on lines 325..343

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 69.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        try {
          await this._admin.createTopics({
            /**
             * NOTE: If you don't wait for leaders the system throws an error when trying to write to the topic if a leader
             * hasn't been selected.
    packages/deep-microservice-analysis/src/analysis-service.js on lines 290..309

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 69.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

      async _addSentiment(economicEntity, utcDateTime, data) {
        if (!validEconomicEntities([economicEntity])) {
          throw new Error(
            `Invalid economic entity received:\n${JSON.stringify(economicEntity)}`
          );
    Severity: Minor
    Found in packages/deep-microservice-analysis/src/datasource/neo4j-store.js - About 1 hr to fix

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

        async _computeSentiment(economicEntity, datas) {
          if (!validEconomicEntities([economicEntity])) {
            throw new Error(`An invalid economic entity was received.`);
          }
      
      
      Severity: Minor
      Found in packages/deep-microservice-analysis/src/analysis-service.js - About 1 hr to fix

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

          async _handleTweetsFetched(utcDateTime, economicEntity, tweets) {
            if (!validDate(utcDateTime)) {
              throw new Error(`${utcDateTime} is an invalid date.`);
            }
        
        
        Severity: Minor
        Found in packages/deep-microservice-collection/src/collection-service.js - About 1 hr to fix

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

            const validateAndFetchPermissionsAndMe = async (connectionParams, extra) => {
              if (!extra?.request) {
                throw new Error('The request object was not valid.');
              }
          
          
          Severity: Minor
          Found in packages/deep-microservice-subscription/src/index.js - About 1 hr to fix

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

              constructor() {
                super();
            
                this.configuration = {observedEconomicEntities: []};
            
            
            Severity: Minor
            Found in packages/deep-economic-analyzer/deep-site-configuration.js - About 1 hr to fix

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  try {
                    const alreadyExists = await this._k8sClient.exists(
                      'cronjob',
                      this._options.name,
                      this._options.namespace
              packages/deep-microservice-collection/src/command/k8s-cron-job.js on lines 121..130

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 63.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Function _selectionInputs has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                _selectionInputs(siteConfiguration) {
                  return html`
                    <div class="input selection">
                      <mwc-select
                        id="business"
              Severity: Minor
              Found in packages/deep-economic-analyzer/deep-analyzer-page-summary.js - About 1 hr to fix

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    try {
                      this._logger.info(`Deleting cron job.\n\n${stringify(this._obj)}`);
                      await this._k8sClient.delete(this._obj);
                    } catch (e) {
                      this._logger.error(
                packages/deep-microservice-collection/src/command/k8s-cron-job.js on lines 39..112

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 63.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Function connect has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  async connect() {
                    this._logger.info(`Connecting to analysis service support systems.`);
                
                    await attachExitHandler(async () => {
                      this._logger.info('Cleaning up kafka connections.');
                Severity: Minor
                Found in packages/deep-microservice-analysis/src/analysis-service.js - About 1 hr to fix

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

                    async readMostRecentSentiment(economicEntity) {
                      if (!validEconomicEntities([economicEntity])) {
                        throw new Error(
                          `Invalid economic entity received:\n${JSON.stringify(economicEntity)}`
                        );
                  Severity: Minor
                  Found in packages/deep-microservice-analysis/src/datasource/neo4j-store.js - About 1 hr to fix

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

                      _validSentimentDatas(datas) {
                        if (!Array.isArray(datas) || datas.length <= 0) {
                          return false;
                        }
                    
                    
                    Severity: Minor
                    Found in packages/deep-microservice-analysis/src/analysis-service.js - 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 _webSites has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                      async _webSites(
                        subject,
                        searchEngine = DDG,
                        reqLib = axios,
                        robotsTxtParser = robotsParser
                    Severity: Minor
                    Found in packages/data-collector/src/data-scraper.js - 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

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                      static graphQLTypeDefinition() {
                        return `
                                enum ${this.graphQLType()} {
                                    ${this.types.map(
                                      (type) => `
                    Severity: Major
                    Found in packages/model/src/economic-entity-type.js and 1 other location - About 1 hr to fix
                    packages/model/src/economic-sector-type.js on lines 34..44

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 60.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                      static graphQLTypeDefinition() {
                        return `
                                    enum ${this.graphQLType()} {
                                        ${this.types.map(
                                          (type) => `
                    Severity: Major
                    Found in packages/model/src/economic-sector-type.js and 1 other location - About 1 hr to fix
                    packages/model/src/economic-entity-type.js on lines 33..43

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 60.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

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

                    const startGatewayService = async () => {
                      const gateway = new ApolloGateway({
                        serviceList: [
                          {
                            name: 'analysis',
                    Severity: Minor
                    Found in packages/deep-microservice-gateway/src/index.js - 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 _webSites has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      async _webSites(
                        subject,
                        searchEngine = DDG,
                        reqLib = axios,
                        robotsTxtParser = robotsParser
                    Severity: Minor
                    Found in packages/data-collector/src/data-scraper.js - About 1 hr to fix

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

                        render() {
                          return html`
                            <div class="grid">
                              <h1 class="slogan">${translate('translations:headline')}</h1>
                              <div class="features">
                      Severity: Minor
                      Found in packages/deep-economic-analyzer/deep-analyzer-page-home.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language