ThinkDeepTech/thinkdeep

View on GitHub

Showing 104 of 104 total issues

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

  const extractPermissions = jwt({
    secret: jwks.expressJwtSecret({
      cache: true,
      rateLimit: true,
      jwksRequestsPerMinute: 5,
Severity: Major
Found in packages/deep-microservice-gateway/src/index.js and 1 other location - About 2 hrs to fix
packages/deep-microservice-subscription/src/index.js on lines 30..41

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 92.

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

  const validateAndAppendPermissions = jwt({
    secret: jwks.expressJwtSecret({
      cache: true,
      rateLimit: true,
      jwksRequestsPerMinute: 5,
Severity: Major
Found in packages/deep-microservice-subscription/src/index.js and 1 other location - About 2 hrs to fix
packages/deep-microservice-gateway/src/index.js on lines 60..71

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 92.

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

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

export default class DeepAnalyzerPageSummary extends LitElement {
  /**
   * Lit component property definitions.
   */
  static get properties() {
Severity: Minor
Found in packages/deep-economic-analyzer/deep-analyzer-page-summary.js - About 2 hrs to fix

    Function startApolloServer has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const startApolloServer = async () => {
      await attachExitHandler(async () => {
        await mongoClient.close();
      });
    
    
    Severity: Major
    Found in packages/deep-microservice-configuration/src/index.js - About 2 hrs to fix

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

      startApolloServer()
        .then(() => {
          /* Do nothing */
        })
        .catch((error) => {
      Severity: Major
      Found in packages/deep-microservice-configuration/src/index.js and 1 other location - About 2 hrs to fix
      packages/deep-microservice-collection/src/index.js on lines 200..211

      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 89.

      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

      export default {
        companyName: 'Predecos',
        companyStreetNumber: '349',
        companyStreetName: 'Oliver Street',
        companyCityName: 'Geordon',
      Severity: Major
      Found in packages/deep-economic-analyzer/locales/en-CA/common.js and 1 other location - About 2 hrs to fix
      packages/deep-economic-analyzer/locales/en-US/common.js on lines 1..19

      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 89.

      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

      export default {
        companyName: 'Predecos',
        companyStreetNumber: '349',
        companyStreetName: 'Oliver Street',
        companyCityName: 'Beverton',
      Severity: Major
      Found in packages/deep-economic-analyzer/locales/en-US/common.js and 1 other location - About 2 hrs to fix
      packages/deep-economic-analyzer/locales/en-CA/common.js on lines 1..19

      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 89.

      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

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

      startApolloServer()
        .then(() => {
          /* Do nothing */
        })
        .catch((error) => {
      Severity: Major
      Found in packages/deep-microservice-collection/src/index.js and 1 other location - About 2 hrs to fix
      packages/deep-microservice-configuration/src/index.js on lines 108..119

      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 89.

      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

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

              variables: {
                economicEntities: [],
                startDate: this._utcDateString(DEFAULT_START_DATE, {
                  hour: 0,
                  minute: 0,
      packages/deep-economic-analyzer/deep-analyzer-page-summary.js on lines 99..115

      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 88.

      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

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

              variables: {
                economicEntities: [],
                startDate: this._utcDateString(DEFAULT_START_DATE, {
                  hour: 0,
                  minute: 0,
      packages/deep-economic-analyzer/deep-analyzer-page-summary.js on lines 63..79

      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 88.

      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

      const objectifyWebSites = (subjects) => {
        if (!validWebSites(subjects)) {
          throw new Error(`Web sites provided were invalid.`);
        }
      
      
      Severity: Major
      Found in packages/model/src/web-site.js and 1 other location - About 2 hrs to fix
      packages/model/src/economic-entity.js on lines 131..142

      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 84.

      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

      const objectifyEconomicEntities = (economicEntities) => {
        if (!validEconomicEntities(economicEntities)) {
          throw new Error(`Economic entities provided were invalid`);
        }
      
      
      Severity: Major
      Found in packages/model/src/economic-entity.js and 1 other location - About 2 hrs to fix
      packages/model/src/web-site.js on lines 79..90

      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 84.

      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 startApolloServer has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      const startApolloServer = async () => {
        const validateAndAppendPermissions = jwt({
          secret: jwks.expressJwtSecret({
            cache: true,
            rateLimit: true,
      Severity: Minor
      Found in packages/deep-microservice-subscription/src/index.js - 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

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

      startApolloServer()
        .then(() => {
          /* Do nothing */
        })
        .catch((error) => {
      Severity: Major
      Found in packages/deep-microservice-subscription/src/index.js and 1 other location - About 2 hrs to fix
      packages/deep-microservice-gateway/src/index.js on lines 152..162

      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 78.

      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

      startGatewayService()
        .then(() => {
          /* Do nothing */
        })
        .catch((error) => {
      Severity: Major
      Found in packages/deep-microservice-gateway/src/index.js and 1 other location - About 2 hrs to fix
      packages/deep-microservice-subscription/src/index.js on lines 256..266

      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 78.

      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

      File collection-service.js has 255 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import {
        EconomicEntityFactory,
        EconomicEntityType,
        validEconomicEntities,
      } from '@thinkdeep/model';
      Severity: Minor
      Found in packages/deep-microservice-collection/src/collection-service.js - About 2 hrs to fix

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

          async execute() {
            try {
              this._obj = await this._k8sClient.create(`
                            apiVersion: "batch/v1"
                            kind: "Job"
        Severity: Minor
        Found in packages/deep-microservice-collection/src/command/k8s-job.js - About 1 hr to fix

          Function initApolloClient has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const initApolloClient = async (user) => {
            const authHeaders = (_user) => {
              return {
                authorization: _user?.accessToken ? `Bearer ${_user.accessToken}` : '',
                me: _user?.idToken ? _user.idToken : '',
          Severity: Minor
          Found in packages/deep-economic-analyzer/graphql/client.js - About 1 hr to fix

            Function styles has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              static get styles() {
                return [
                  css`
                    :host {
                      display: grid;
            Severity: Minor
            Found in packages/deep-footer/deep-footer.js - About 1 hr to fix

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

                async listen() {
                  this._logger.info(`Starting apollo server.`);
                  await this._apolloServer.start();
              
                  this._expressApp.disable('x-powered-by');
              Severity: Minor
              Found in packages/deep-microservice-analysis/src/microservice.js - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language