Showing 13 of 13 total issues
Function createPassthrough
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function createPassthrough(fakeXHR, nativeXMLHttpRequest) {
// event types to handle on the xhr
var evts = ['error', 'timeout', 'abort', 'readystatechange'];
// event types to handle on the xhr.upload
File pretender.ts
has 291 lines of code (exceeds 250 allowed). Consider refactoring. Open
import * as FakeFetch from 'whatwg-fetch';
import FakeXMLHttpRequest from 'fake-xml-http-request';
import { Params, QueryParams } from 'route-recognizer';
import { ResponseHandler, ResponseHandlerInstance } from '../index.d';
import Hosts from './hosts';
Function createPassthrough
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
export function createPassthrough(fakeXHR, nativeXMLHttpRequest) {
// event types to handle on the xhr
var evts = ['error', 'timeout', 'abort', 'readystatechange'];
// event types to handle on the xhr.upload
- 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"
Further reading
Function interceptor
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function interceptor(ctx) {
function FakeRequest() {
// super()
FakeXMLHttpRequest.call(this);
}
Function handleRequest
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
handleRequest(request: FakeRequest) {
let verb = request.method.toUpperCase();
let path = request.url;
let handler = this._handlerFor(verb, path, request);
Function exports
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: "",
Function handleRequest
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
handleRequest(request: FakeRequest) {
let verb = request.method.toUpperCase();
let path = request.url;
let handler = this._handlerFor(verb, path, request);
- 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"
Further reading
Function scheduleProgressEvent
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function scheduleProgressEvent(request, startTime, totalTime) {
let totalSize = 0;
const body = request.requestBody;
if (body) {
if (body instanceof FormData) {
Function interceptor
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export function interceptor(ctx) {
function FakeRequest() {
// super()
FakeXMLHttpRequest.call(this);
}
- 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"
Further reading
Function constructor
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor() {
let lastArg = arguments[arguments.length - 1];
let options = typeof lastArg === 'object' ? lastArg : null;
let shouldNotTrack = options && options.trackRequests === false;
Function constructor
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
constructor() {
let lastArg = arguments[arguments.length - 1];
let options = typeof lastArg === 'object' ? lastArg : null;
let shouldNotTrack = options && options.trackRequests === false;
- 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"
Further reading
Function Pretender
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
var Pretender = (function(self) {
function getModuleDefault(module) {
return module.default || module;
}
- 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"
Further reading
Function handleResponse
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
handleResponse(request: FakeRequest, strategy, callback: Function) {
let delay = typeof strategy === 'function' ? strategy() : strategy;
delay = typeof delay === 'boolean' || typeof delay === 'number' ? delay : 0;
if (delay === false) {
- 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"