Showing 13 of 107 total issues
File requests.ts
has 546 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* Type safe wrapper around the fetch API
*/
// eslint-disable camelcase
File responses.ts
has 421 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable sonarjs/no-duplicate-string */
import * as express from "express";
import * as t from "io-ts";
import { errorsToReadableMessages } from "./reporters";
File requests.test.ts
has 304 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { isLeft, right } from "fp-ts/lib/Either";
import * as t from "io-ts";
import {
basicResponseDecoder,
Function mockRes
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function mockRes(): any {
const response = {
append: jest.fn(),
attachment: jest.fn(),
clearCookie: jest.fn(),
Function createFetchRequestForApi
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function createFetchRequestForApi<
P,
KH extends RequestHeaderKey,
Q extends string,
R
Function withRetries
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
(task, shouldAbort = Promise.resolve(false)) => {
// Whether we must stop retrying
// the abort process gets triggered when the shouldAbort promise resolves
// to true. Not that aborting stops the retry process, it does NOT stop
// the execution of the current task.
Function startAppInsights
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function startAppInsights(
connectionString: string,
aiConfig: ApplicationInsightsConfig
): appInsights.TelemetryClient {
const ai = appInsights.setup(connectionString);
Function withRetries
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
<E, T>(
maxRetries: number,
backoff: (count: number) => Millisecond
): ((
_: RetriableTask<E, T>,
- 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 mockReq
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function mockReq(): any {
const request = {
accepts: jest.fn(),
acceptsCharset: jest.fn(),
acceptsCharsets: jest.fn(),
Function getContextPathSimplified
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const getContextPathSimplified = (context: Context): string => {
if (context.length === 0) {
return " (decoder info n/a)";
}
- 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 filter
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const filter = <A, E = unknown>(
p: Pot<A, E>,
f: (v: A) => boolean
): Pot<A, E> =>
fold(
- 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 getKeepAliveAgentOptions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const getKeepAliveAgentOptions = (env: typeof process.env) => ({
freeSocketTimeout:
env.FETCH_KEEPALIVE_FREE_SOCKET_TIMEOUT === undefined
? undefined
: parseInt(env.FETCH_KEEPALIVE_FREE_SOCKET_TIMEOUT, 10),
- 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 patternDateFromString
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const patternDateFromString = (
pattern: string,
tagName: string
): t.Type<Date, string> =>
new t.Type<Date, string>(
- 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"