maestro-server/server-app

View on GitHub

Showing 102 of 102 total issues

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

        updateForgotPassword (req, res, next) {

            AuthService(Entity)
                .updateForgotPassword(req.body, req.header)
                .then(e => res.status(204).json(e))
Severity: Major
Found in app/identity/applications/authApplication.js and 1 other location - About 1 hr to fix
app/identity/applications/authApplication.js on lines 19..28

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

        updateExistPassword (req, res, next) {

            AuthService(Entity)
                .updateExistPassword(req.body, req.user)
                .then(e => res.status(201).json(e))
Severity: Major
Found in app/identity/applications/authApplication.js and 1 other location - About 1 hr to fix
app/identity/applications/authApplication.js on lines 40..49

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

        findOne (_id, owner, access = Access.ROLE_READ) {

            return new Promise((resolve, reject) => {

                const prepared = accessMergeTransform(owner, Entity.access, {_id}, access);
Severity: Major
Found in app/inventory/applications/PersistenceServices.js and 2 other locations - About 1 hr to fix
app/core/services/PersistenceServices.js on lines 60..71
app/inventory/applications/PersistenceServices.js on lines 73..83

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

        remove(_id, owner, access = Access.ROLE_ADMIN) {

            return new Promise((resolve, reject) => {
                const prepared = accessMergeTransform(owner, Entity.access, {_id}, access);

Severity: Major
Found in app/inventory/applications/PersistenceServices.js and 2 other locations - About 1 hr to fix
app/core/services/PersistenceServices.js on lines 60..71
app/inventory/applications/PersistenceServices.js on lines 36..47

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

        findOne (_id, owner, access = Access.ROLE_READ) {

            return new Promise((resolve, reject) => {

                const prepared = accessMergeTransform(owner, Entity.access, {_id}, access);
Severity: Major
Found in app/core/services/PersistenceServices.js and 2 other locations - About 1 hr to fix
app/inventory/applications/PersistenceServices.js on lines 36..47
app/inventory/applications/PersistenceServices.js on lines 73..83

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 HTTPService has 41 lines of code (exceeds 25 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 1 hr to fix

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

            single_rules(req, res, next) {
                const provider = _.get(req.params, 'provider');
    
                DiscoveryHTTPService()
                    .find(`/available/rules/${provider}`)
    Severity: Major
    Found in app/inventory/applications/persistenceConnection.js and 1 other location - About 1 hr to fix
    app/inventory/applications/persistenceConnection.js on lines 30..37

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

    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

            single(req, res, next) {
                const provider = _.get(req.params, 'provider');
    
                DiscoveryHTTPService()
                    .find(`/available/info/${provider}`)
    Severity: Major
    Found in app/inventory/applications/persistenceConnection.js and 1 other location - About 1 hr to fix
    app/inventory/applications/persistenceConnection.js on lines 47..54

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

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

    const UploaderService = (Entity) => {
      const typeU = process.env.MAESTRO_UPLOAD_TYPE || TYPE_DEFAULT;
      const FUploaderRepository = require(`core/repositories/uploader${typeU}Repository`);
    
      const UploaderRepository = FUploaderRepository(Entity.name);
    Severity: Minor
    Found in app/core/services/UploaderService.js - About 1 hr to fix

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

      module.exports = function (gulp, $) {
          'use strict';
      
          gulp.task('test_unit', function () {
              return gulp.src(['test/unit/**/*.js'])
      Severity: Major
      Found in tasks/test_unit.js and 1 other location - About 1 hr to fix
      tasks/test_e2e.js on lines 7..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 80.

      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

      module.exports = function (gulp, $) {
          'use strict';
      
          gulp.task('test_e2e', function () {
              return gulp.src(['test/e2e/**/*.js'])
      Severity: Major
      Found in tasks/test_e2e.js and 1 other location - About 1 hr to fix
      tasks/test_unit.js on lines 7..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 80.

      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

                  PersistenceServices(Entity)
                      .findOne(req.params.id, req.user)
                      .then(notExist)
                      .then(DatacenterOrphans(req)(PersistenceServices))
                      .then(e => res.json(e))
      Severity: Major
      Found in app/inventory/applications/persistenceDatacenters.js and 1 other location - About 1 hr to fix
      app/reports/applications/persistenceScheduler.js on lines 37..42

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

      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

                  PersistenceServices(Entity)
                      .findOne(req.params.id, req.user)
                      .then(notExist)
                      .then(SchedulerEvents(query)(PersistenceServices))
                      .then(e => res.json(e))
      Severity: Major
      Found in app/reports/applications/persistenceScheduler.js and 1 other location - About 1 hr to fix
      app/inventory/applications/persistenceDatacenters.js on lines 15..20

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

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

      const ApplicationSchedulers = (Entity, PersistenceServices = DPersistenceServices) => {
      
          return {
              find(req, res, next) {
                  const field = 'query';
      Severity: Minor
      Found in app/reports/applications/persistenceScheduler.js - About 1 hr to fix

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

        const CallReportApi = (owner_user = null, req = null) => {
        
            return {
                create(e) {
                    const data = {
        Severity: Minor
        Found in app/reports/applications/transform/callReportApi.js - About 1 hr to fix

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

          const AuthApp = (Entity) => {
          
              return {
                  login (req, res, next) {
          
          
          Severity: Minor
          Found in app/identity/applications/authApplication.js - About 1 hr to fix

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

            const validateFile = (file, opts) => {
            
                const defaultParams = {
                    maxsize: process.env.MAESTRO_UPLOAD_MAXSIZE | 16302400, //~10 mb,
                    minsize: process.env.MAESTRO_UPLOAD_MINSIZE | 1, // 1 kbs
            Severity: Minor
            Found in app/core/services/validator/uploadValid.js - About 1 hr to fix

              Function AccessApp has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const AccessApp = (Entity, AccessServices = DAccessServices) => {
              
                  return {
              
                      update: (req, res, next) => {
              Severity: Minor
              Found in app/core/applications/accessApplication.js - About 1 hr to fix

                Function HealthCheck has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const HealthCheck = () => {
                
                    const handle_services = (Service) => {
                        const {name} = Service;
                
                
                Severity: Minor
                Found in app/core/applications/healthCheckApplication.js - About 1 hr to fix

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

                  const DatacentersConnection = (result, req, PersistenceServices, Entity) => {
                      const dc_id = _.get(result, 'dc_id');
                  
                      return {
                          connected() {
                  Severity: Minor
                  Found in app/inventory/services/DatacentersConnection.js - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language