GladysProject/Gladys

View on GitHub
server/lib/device/device.calculateAggregate.js

Summary

Maintainability
A
3 hrs
Test Coverage

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

async function calculateAggregate(type, jobId) {
  logger.info(`Calculating aggregates device feature state for interval ${type}`);
  // First we get the retention policy of this aggregates type
  let retentionPolicyInDays = await this.variable.getValue(AGGREGATES_POLICY_RETENTION_VARIABLES[type]);

Severity: Major
Found in server/lib/device/device.calculateAggregate.js - About 2 hrs to fix

    Function promise has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      const promise = new Promise((resolve, reject) => {
        let err = '';
        const childProcess = spawn('node', [SCRIPT_PATH, JSON.stringify(params)]);
    
        childProcess.stdout.on('data', async (data) => {
    Severity: Minor
    Found in server/lib/device/device.calculateAggregate.js - About 1 hr to fix

      There are no issues that match your filters.

      Category
      Status