samcday/node-google-spreadsheets

View on GitHub

Showing 12 of 14 total issues

Function getFeed has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

var getFeed = function(params, auth, query, cb) {
  var visibility = "public";
  var projection = "values";

  var options = {
Severity: Minor
Found in lib/spreadsheets.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 Row has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

var Row = function(data) {
  Object.keys(data).forEach(function(key) {
    var val;
    val = data[key];
    if(key.substring(0, 4) === "gsx:")  {
Severity: Minor
Found in lib/spreadsheets.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

File spreadsheets.js has 260 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"use strict";

var axios = require("axios");
var statuses = require("statuses");
var querystring = require("querystring");
Severity: Minor
Found in lib/spreadsheets.js - About 2 hrs to fix

    Function getFeed has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var getFeed = function(params, auth, query, cb) {
      var visibility = "public";
      var projection = "values";
    
      var options = {
    Severity: Minor
    Found in lib/spreadsheets.js - About 1 hr to fix

      Function rows has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      Spreadsheets.rows = function(opts, cb) {
        if(!opts) {
          throw new Error("Invalid arguments.");
        }
        if(!opts.key) {
      Severity: Minor
      Found in lib/spreadsheets.js - About 1 hr to fix

        Function cells has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Spreadsheets.cells = function(opts, cb) {
          if(!opts) {
            throw new Error("Invalid arguments.");
          }
          if(!opts.key) {
        Severity: Minor
        Found in lib/spreadsheets.js - About 1 hr to fix

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

          var Row = function(data) {
            Object.keys(data).forEach(function(key) {
              var val;
              val = data[key];
              if(key.substring(0, 4) === "gsx:")  {
          Severity: Minor
          Found in lib/spreadsheets.js - About 1 hr to fix

            Function cells has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            Spreadsheets.cells = function(opts, cb) {
              if(!opts) {
                throw new Error("Invalid arguments.");
              }
              if(!opts.key) {
            Severity: Minor
            Found in lib/spreadsheets.js - About 45 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

            Function rows has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            Spreadsheets.rows = function(opts, cb) {
              if(!opts) {
                throw new Error("Invalid arguments.");
              }
              if(!opts.key) {
            Severity: Minor
            Found in lib/spreadsheets.js - About 45 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

            Avoid too many return statements within this function.
            Open

                  return cb(new Error("HTTP error " + response.status + ": " + statuses[response.status]));
            Severity: Major
            Found in lib/spreadsheets.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return cb(new Error("Invalid authorization key."));
              Severity: Major
              Found in lib/spreadsheets.js - About 30 mins to fix

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

                Spreadsheets = module.exports = function(opts, cb) {
                  if(!opts) {
                    throw new Error("Invalid arguments.");
                  }
                  if(!opts.key) {
                Severity: Minor
                Found in lib/spreadsheets.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