maestro-server/server-app

View on GitHub

Showing 102 of 102 total issues

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

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

            return this._collection()
                .then((collection) => {
                    const subs = entry ? {[entry]: this.get()} : this.get();
                    return collection.replaceOne(entity, subs, options);
                })
    Severity: Major
    Found in app/core/repositories/daos/DBConnector.js and 2 other locations - About 2 hrs to fix
    app/core/repositories/daos/DBConnector.js on lines 195..203
    app/core/repositories/daos/DBConnector.js on lines 208..216

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

    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

            return this._collection()
                .then((collection) => {
                    const subs = entry ? {[entry]: this.get()} : this.get();
                    return collection.updateOne(entity, subs, options);
                })
    Severity: Major
    Found in app/core/repositories/daos/DBConnector.js and 2 other locations - About 2 hrs to fix
    app/core/repositories/daos/DBConnector.js on lines 151..159
    app/core/repositories/daos/DBConnector.js on lines 208..216

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

    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

            return this._collection()
                .then((collection) => {
                    const subs = entry ? {[entry]: this.get()} : this.get();
                    return collection.updateMany(entity, subs, options);
                })
    Severity: Major
    Found in app/core/repositories/daos/DBConnector.js and 2 other locations - About 2 hrs to fix
    app/core/repositories/daos/DBConnector.js on lines 151..159
    app/core/repositories/daos/DBConnector.js on lines 195..203

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

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

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

      const auditHookUpdated = ({entity, fill}) => (data) => {
          const cleandata = _.pick(data, fill);
      
          AuditHTTPService()
              .update(`/audit/${entity}/${data['_id']}/${_.get(data, 'user.email', '?')}`, cleandata)
      Severity: Major
      Found in app/core/hooks/auditHookUpdated.js and 1 other location - About 2 hrs to fix
      app/core/hooks/auditHookPatched.js on lines 17..26

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

      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 auditHookPatched = ({entity, fill}) => (data) => {
          const cleandata = _.pick(data, fill);
      
          AuditHTTPService()
              .patch(`/audit/${entity}/${data['_id']}/${_.get(data, 'user.email', '?')}`, cleandata)
      Severity: Major
      Found in app/core/hooks/auditHookPatched.js and 1 other location - About 2 hrs to fix
      app/core/hooks/auditHookUpdated.js on lines 17..25

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

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

      const DepsServices = (Entity, field, FactoryDBRepository = DFactoryDBRepository, FactoryDBBatch = DFactoryDBBatch) => {
      
          const DBRepository = FactoryDBRepository(Entity);
          const DBBatch = FactoryDBBatch(Entity);
      
      
      Severity: Major
      Found in app/inventory/services/DependenciesServices.js - About 2 hrs to fix

        Function PersistenceGraph has 65 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const PersistenceGraph = (Entity, PersistenceServices = DPersistenceServices) => {
        
            return {
                find(req, res, next) {
                    const field = 'query';
        Severity: Major
        Found in app/analytics/applications/persistenceGraph.js - About 2 hrs to fix

          Function exports has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

          module.exports = function (query, field = 'query', rules = []) {
              if (query.hasOwnProperty(field)) {
                  let omits = [];
          
                  for (let rule in rules) {
          Severity: Minor
          Found in app/core/applications/transforms/filterHooks.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

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

          const UploaderRepository = (folder) => {
              const base_api = (host) => {
                  const url = process.env.API_URL || `//${host}`;
                  return url.replace(/\/$/, "");
              };
          Severity: Major
          Found in app/core/repositories/uploaderLocalRepository.js - About 2 hrs to fix

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

                    addList(_id, post, owner, access = Access.ROLE_READ) {
            
                        return new Promise((resolve, reject) => {
            
                            const prepared = _.assign({},
            Severity: Major
            Found in app/inventory/services/PersistenceServices.js and 1 other location - About 2 hrs to fix
            app/inventory/services/PersistenceServices.js on lines 30..44

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 96.

            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

                    removeList(_id, post, owner, access = Access.ROLE_WRITE) {
            
                        return new Promise((resolve, reject) => {
            
                            const prepared = _.assign({},
            Severity: Major
            Found in app/inventory/services/PersistenceServices.js and 1 other location - About 2 hrs to fix
            app/inventory/services/PersistenceServices.js on lines 14..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 96.

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

            const Persistence = (Entity, FactoryDBRepository = DFactoryDBRepository) => {
            
                const DBRepository = FactoryDBRepository(Entity);
            
                return {
            Severity: Major
            Found in app/inventory/applications/PersistenceServices.js - About 2 hrs to fix

              Function find has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              Query.prototype.find = function (query, options) {
                  let Model = this.model;
              
                  query = _.assign({}, this.query, query);
              
              
              Severity: Minor
              Found in app/core/repositories/daos/connector/query.js - About 2 hrs to fix

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

                const connections = function () {
                    const module = 'connections';
                    let template = null;
                
                    const populate = async function () {
                Severity: Minor
                Found in app/reports/services/templates/connections.js - About 1 hr to fix

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

                  const WrapperPersistenceApp = (Entity) => (ACEntity) => (FactoryPesistenceApp = DFactoryPesistenceApp) => (apply) => {
                  
                      const PesistenceApp = FactoryPesistenceApp(Entity);
                  
                      const factoryWrapper = function(method, access) {
                  Severity: Minor
                  Found in app/core/applications/wrapperPersistenceApplication.js - About 1 hr to fix

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

                            create(e) {
                                const data = {
                                    "report_id": e["_id"],
                                    "component": e['component'],
                                    "filters": JSON.stringify(e['filters'], null, 2),
                    Severity: Major
                    Found in app/reports/applications/transform/callReportApi.js and 1 other location - About 1 hr to fix
                    app/reports/applications/transform/callReportApi.js on lines 33..43

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 87.

                    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(e) {
                                const data = {
                                    "report_id": e["_id"],
                                    "component": e['component'],
                                    "filters": JSON.stringify(e['filters'], null, 2),
                    Severity: Major
                    Found in app/reports/applications/transform/callReportApi.js and 1 other location - About 1 hr to fix
                    app/reports/applications/transform/callReportApi.js on lines 9..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 87.

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

                    const UsersPersistence = (Entity) => {
                    
                        const DBRepository = FactoryDBRepository(Entity);
                    
                        return Object.assign({}, Persistence(Entity), {
                    Severity: Minor
                    Found in app/identity/services/PersistenceServices.js - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language