maestro-server/server-app

View on GitHub

Showing 42 of 102 total issues

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

    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

      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

            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

              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

                  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

                        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

                                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

                                  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

                                    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
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language