Godzil/Crunchy

View on GitHub
src/my_request.ts

Summary

Maintainability
B
4 hrs
Test Coverage

File my_request.ts has 340 lines of code (exceeds 250 allowed). Consider refactoring.
Wontfix

'use strict';
import cheerio = require('cheerio');
import request = require('request');
import rp = require('request-promise');
import Promise = require('bluebird');
Severity: Minor
Found in src/my_request.ts - About 4 hrs to fix

    Function checkIfUserIsAuth has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Wontfix

    function checkIfUserIsAuth(config: IConfig, done: (err: any) => void): void
    {
      /**
       * The main page give us some information about the user
       */
    Severity: Major
    Found in src/my_request.ts - About 2 hrs to fix

      Function authUsingForm has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function authUsingForm(config: IConfig, done: (err: any) => void)
      {
        /* So if we are here now, that mean we are not authenticated so do as usual */
        if (!config.pass || !config.user)
        {
      Severity: Minor
      Found in src/my_request.ts - About 1 hr to fix

        Function authUsingApi has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function authUsingApi(config: IConfig, done: (err: any) => void)
        {
          if (!config.pass || !config.user)
          {
            log.error('You need to give login/password to use Crunchy');
        Severity: Minor
        Found in src/my_request.ts - About 1 hr to fix

          Function getOptions has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function getOptions(config: IConfig, form: any)
          {
            if (!optionsSet)
            {
              currentOptions = {};
          Severity: Minor
          Found in src/my_request.ts - About 1 hr to fix

            Function getOptions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            function getOptions(config: IConfig, form: any)
            {
              if (!optionsSet)
              {
                currentOptions = {};
            Severity: Minor
            Found in src/my_request.ts - About 35 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

            There are no issues that match your filters.

            Category
            Status