maestro-server/server-app

View on GitHub

Showing 80 of 80 total issues

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

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

        updateManyFactory(entity, entry, options) {
    
            return this._collection()
                .tap(() => {
                    return this._runHooks('before', 'update');
    Severity: Major
    Found in app/core/repositories/daos/DBConnector.js and 1 other location - About 4 hrs to fix
    app/core/repositories/daos/DBConnector.js on lines 66..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 143.

    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

        updateFactory(entity, entry, options) {
    
            return this._collection()
                .tap(() => {
                    return this._runHooks('before', 'update');
    Severity: Major
    Found in app/core/repositories/daos/DBConnector.js and 1 other location - About 4 hrs to fix
    app/core/repositories/daos/DBConnector.js on lines 82..96

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

    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

            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

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

            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

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

    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

    Function Persistence has 93 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

      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 HTTPService has a Cognitive Complexity of 24 (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

          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

          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

          Function AuthService has 72 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const AuthService = (Entity) => {
          
              const DBRepository = FactoryDBRepository(Entity);
          
              return {
          Severity: Major
          Found in app/identity/services/AuthService.js - About 2 hrs to fix

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

            const AccessServices = (Entity, user={}, FactoryDBRepository = DFactoryDBRepository) => {
            
                const DBRepository = FactoryDBRepository(Entity);
            
                return {
            Severity: Major
            Found in app/core/services/AccessServices.js - About 2 hrs to fix
              Severity
              Category
              Status
              Source
              Language