maestro-server/server-app

View on GitHub

Showing 102 of 102 total issues

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

Query.prototype.exclude = function (key, value) {

    if (Array.isArray(key)) {
        let projection = key;
        projection.forEach((k) => this.exclude(k));
Severity: Major
Found in app/core/repositories/daos/connector/query.js and 1 other location - About 6 hrs to fix
app/core/repositories/daos/connector/query.js on lines 64..80

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

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

Query.prototype.include = function (key, value) {
    if (Array.isArray(key)) {
        let projection = key;
        projection.forEach((k) => this.include(k));

Severity: Major
Found in app/core/repositories/daos/connector/query.js and 1 other location - About 6 hrs to fix
app/core/repositories/daos/connector/query.js on lines 82..99

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

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

        update (req, res, next) {

            _.defaults(req.body, Entity.defaults || {});

            const bodyWithOwner = Object.assign(
Severity: Major
Found in app/core/applications/persistenceApplication.js and 1 other location - About 5 hrs to fix
app/core/applications/persistenceApplication.js on lines 97..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 153.

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

        patch (req, res, next) {

            _.defaults(req.body, Entity.defaults || {});

            const bodyWithOwner = Object.assign(
Severity: Major
Found in app/core/applications/persistenceApplication.js and 1 other location - About 5 hrs to fix
app/core/applications/persistenceApplication.js on lines 80..95

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

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

const DBRepository = (Entity, options = {}) => {

    const DB = Entity.dao;

    return {
Severity: Major
Found in app/core/repositories/DBRepository.js - About 5 hrs to fix

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

            task(req, res, next) {
                PersistenceServices(Entity)
                    .findOne(req.params.id, req.user)
                    .then(notExist)
                    .then((e) => {
    Severity: Major
    Found in app/reports/applications/persistenceReports.js and 1 other location - About 4 hrs to fix
    app/inventory/applications/persistenceConnection.js on lines 101..111

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

    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

            task(req, res, next) {
                PersistenceServices(Entity)
                    .findOne(req.params.id, req.user)
                    .then(notExist)
                    .then((e) => {
    Severity: Major
    Found in app/inventory/applications/persistenceConnection.js and 1 other location - About 4 hrs to fix
    app/reports/applications/persistenceReports.js on lines 117..127

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

    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

            create: (req, res, next) => {
    
                const user = _.get(req, 'auth', req.user);
    
                AccessServices(Entity, user)
    Severity: Major
    Found in app/core/applications/accessApplication.js and 1 other location - About 4 hrs to fix
    app/core/applications/accessApplication.js on lines 13..22

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

    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

            update: (req, res, next) => {
    
                const user = _.get(req, 'auth', req.user);
    
                AccessServices(Entity, user)
    Severity: Major
    Found in app/core/applications/accessApplication.js and 1 other location - About 4 hrs to fix
    app/core/applications/accessApplication.js on lines 24..33

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

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

    const Persistence = (Entity, user = {}, FactoryDBRepository = DFactoryDBRepository) => {
    
        const DBRepository = FactoryDBRepository(Entity);
    
        return {
    Severity: Major
    Found in app/core/services/PersistenceServices.js - About 3 hrs to fix

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

              updateByPushUnique(filter, post, fill = Entity.filled, resFilled = Entity.singleFilled) {
                  return new Promise((resolve, reject) => {
                      const data = _.pick(post, fill);
      
                      return new DB(data)
      Severity: Major
      Found in app/core/repositories/DBRepository.js and 2 other locations - About 3 hrs to fix
      app/core/repositories/DBRepository.js on lines 114..125
      app/core/repositories/DBRepository.js on lines 127..140

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

      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 3 locations. Consider refactoring.
      Open

              updateByPull(filter, post, fill = Entity.filled, resFilled = Entity.singleFilled) {
                  return new Promise((resolve, reject) => {
                      const data = _.pick(post, fill);
      
                      return new DB(data)
      Severity: Major
      Found in app/core/repositories/DBRepository.js and 2 other locations - About 3 hrs to fix
      app/core/repositories/DBRepository.js on lines 99..112
      app/core/repositories/DBRepository.js on lines 127..140

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

      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 3 locations. Consider refactoring.
      Open

              increment(filter, post, fill = Entity.filled, resFilled = Entity.singleFilled) {
                  return new Promise((resolve, reject) => {
                      const data = _.pick(post, fill);
      
                      return new DB(data)
      Severity: Major
      Found in app/core/repositories/DBRepository.js and 2 other locations - About 3 hrs to fix
      app/core/repositories/DBRepository.js on lines 99..112
      app/core/repositories/DBRepository.js on lines 114..125

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

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

      const PersistenceApp = (Entity, PersistenceServices = DPersistenceServices) => {
      
          return {
      
              find (req, res, next) {
      Severity: Major
      Found in app/core/applications/persistenceApplication.js - About 3 hrs to fix

        Function ApplicationReport has 86 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const ApplicationReport = (Entity, PersistenceServices = DPersistenceServices) => {
        
            return {
                create(req, res, next) {
                    _.defaults(req.body, Entity.defaults || {});
        Severity: Major
        Found in app/reports/applications/persistenceReports.js - About 3 hrs to fix

          Function UploaderRepository has 85 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const UploaderRepository = (folder) => {
          
              factoryValid(
                  _.pick(process.env, ['AWS_S3_BUCKET_NAME', 'AWS_ACCESS_KEY_ID', 'AWS_SECRET_ACCESS_KEY']),
                  s3Valid
          Severity: Major
          Found in app/core/repositories/uploaderS3Repository.js - About 3 hrs to fix

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

                    find(req, res, next) {
                        const field = 'query';
                        let query = _.clone(req.query);
            
                        query = jsonParser(query, field);
            Severity: Major
            Found in app/reports/applications/persistenceScheduler.js and 1 other location - About 3 hrs to fix
            app/analytics/applications/persistenceGraph.js on lines 21..34

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

            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

                    find(req, res, next) {
                        const field = 'query';
                        let query = _.clone(req.query);
            
                        query = jsonParser(query, field);
            Severity: Major
            Found in app/analytics/applications/persistenceGraph.js and 1 other location - About 3 hrs to fix
            app/reports/applications/persistenceScheduler.js on lines 19..32

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

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

            const HTTPService = (url) => (header = {}) => {
            
                Object.assign(header, {Authorization: privateToken.token}); // inject private token, used to autheticate on private services
            
                const factoryRequest = (caller, path, args) => {
            Severity: Minor
            Found in app/core/services/HTTPService.js - 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 ApplicationConnection has 79 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const ApplicationConnection = (Entity, PersistenceServices = DPersistenceServices) => {
            
                const formatProvider = (label) => _.toLower(label).replace(/\s/g, "");
            
                return {
            Severity: Major
            Found in app/inventory/applications/persistenceConnection.js - About 3 hrs to fix
              Severity
              Category
              Status
              Source
              Language