src/my_request.ts
File my_request.ts
has 340 lines of code (exceeds 250 allowed). Consider refactoring. Wontfix
Wontfix
'use strict';
import cheerio = require('cheerio');
import request = require('request');
import rp = require('request-promise');
import Promise = require('bluebird');
Function checkIfUserIsAuth
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Wontfix
Wontfix
function checkIfUserIsAuth(config: IConfig, done: (err: any) => void): void
{
/**
* The main page give us some information about the user
*/
Function authUsingForm
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
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)
{
Function authUsingApi
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
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');
Function getOptions
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function getOptions(config: IConfig, form: any)
{
if (!optionsSet)
{
currentOptions = {};
Function getOptions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
function getOptions(config: IConfig, form: any)
{
if (!optionsSet)
{
currentOptions = {};
- Read upRead up
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"