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

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

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

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

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

    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

    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

    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

    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

      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

      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

      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

      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

            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

            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

            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