pcon/sfdc-eventMonitoring

View on GitHub

Showing 5 of 19 total issues

File utils.js has 307 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var chalk = require('chalk');
var lo = require('lodash');
var jsonfile = require('jsonfile');
var moment = require('moment');
var Q = require('q');
Severity: Minor
Found in src/lib/utils.js - About 3 hrs to fix

File sfdc.js has 255 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var Q = require('q');
var csvtojson = require('csvtojson');
var fs = require('fs');
var jsonfile = require('jsonfile');
var jsforce = require('jsforce');
Severity: Minor
Found in src/lib/sfdc.js - About 2 hrs to fix

Function printSummaryLine has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var printSummaryLine = function (data) {
    if (lo.isUndefined(data.info.username)) {
        global.printer.print(chalk.bold('User Id: ') + data.info.userid);
    } else {
        global.printer.print(chalk.bold('Username: ') + data.info.username + ' (' + data.info.userid + ')');
Severity: Minor
Found in src/show/logins.js - About 1 hr to fix

Function filterResults has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var filterResults = function (logs) {
    var deferred = Q.defer();
    var results = [];

    if (
Severity: Minor
Found in src/show/logins.js - About 1 hr to fix

Function setupLogger has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

var setupLogger = function () {
    if (isBunyanLogging()) {
        var stream = { level: 'info' };

        if (global.config.debug) {
Severity: Minor
Found in src/lib/config.js - About 25 mins 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

Severity
Category
Status
Source
Language