Showing 145 of 325 total issues
Function isFilterProvider
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function isFilterProvider(input: unknown): boolean {
if (Array.isArray(input)) {
if (input.length === 2) {
if (Array.isArray(input[1])) {
return isContextCallbackFunction(input[0]) && input[1].every(isContextPrimitive);
- 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 getQuerystring
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function getQuerystring(request: Payload) {
let lowPriorityKeys: { [key: string]: boolean } = { co: true, cx: true };
let args: 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"
Further reading
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
if (Array.isArray(primitivesB)) return false;
Avoid too many return
statements within this function. Open
return currentUrl.pathname != previousUrl.pathname || currentUrl.search != previousUrl.search;
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return document.referrer;
Avoid too many return
statements within this function. Open
if (!isContextPrimitive(b)) return false;
Avoid too many return
statements within this function. Open
return currentUrl.pathname != previousUrl.pathname;
Avoid too many return
statements within this function. Open
return compareProviderPart(primitivesA, primitivesB);
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return compareProviderPart(a, b);
Avoid too many return
statements within this function. Open
return findMediaElementChild(el);
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return primitivesA.reduce<boolean>((matches, a, i) => matches && compareProviderPart(a, primitivesB[i]), true);
Function sendError
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function sendError(
{
errorEvent,
commonContext,
contextAdder,
- 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 sendRequest
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function sendRequest(url: string, userId: string, LOG: Logger, successCallback: () => void): void {
const xhr = new XMLHttpRequest();
xhr.open('GET', getKantarURL(url, userId));
xhr.timeout = 5000;
- 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 getSpecifiedClassesSet
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function getSpecifiedClassesSet<T>(criterion: FilterCriterion<T>) {
// Convert the array of classes to an object of the form {class1: true, class2: true, ...}
var specifiedClassesSet: Record<string, boolean> = {};
var specifiedClasses = criterion.allowlist || criterion.denylist;
- 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 filterFunctionFromFilter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function filterFunctionFromFilter(filter?: Filter): FilterFunction {
// If a function is provided, return it as-is
if (typeof filter === 'function') {
return filter;
}
- 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 findRootDomain
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function findRootDomain(sameSite: string, secure: boolean) {
const windowLocationHostnameAlias = window.location.hostname,
cookiePrefix = '_sp_root_domain_test_',
cookieName = cookiePrefix + new Date().getTime(),
cookieValue = '_test_value_' + new Date().getTime();
- 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"