Growmies/google-adwords

View on GitHub

Showing 4 of 8 total issues

Function GoogleAdwords has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
Open

var GoogleAdwords = function (spec, my) {
  my = my || {}
  spec = spec || {}

  var self = this
Severity: Minor
Found in lib/googleadwords.js - About 1 day 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 GoogleAdwords has 204 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var GoogleAdwords = function (spec, my) {
  my = my || {}
  spec = spec || {}

  var self = this
Severity: Major
Found in lib/googleadwords.js - About 1 day to fix

    Function _sendAWQL has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      var _sendAWQL = function () {
        return new BBPromise(function (resolve, reject) {
          var finalAWQL = _.cloneDeep(my.awqlOptions)
          if (_.isObject(finalAWQL)) {
            finalAWQL =
    Severity: Minor
    Found in lib/googleadwords.js - About 1 hr to fix

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

        var _parseResults = function (body) {
          var _finalObj = {}
          var bodyArray = body.split('\n')
          bodyArray.pop()
          var title = bodyArray[0].split('"').join('')
      Severity: Minor
      Found in lib/googleadwords.js - About 1 hr to fix
        Severity
        Category
        Status
        Source
        Language