Showing 145 of 325 total issues
Function fixupUrl
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function fixupUrl(hostName: string, href: string, referrer: string) {
if (hostName === 'translate.googleusercontent.com') {
// Google
if (referrer === '') {
referrer = href;
- 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 getReferrer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function getReferrer(oldLocation?: string) {
let windowAlias = window,
fromQs =
fromQuerystring('referrer', windowAlias.location.href) || fromQuerystring('referer', windowAlias.location.href);
- 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 newNodeEmitters
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function newNodeEmitters(configuration: NodeEmitterConfiguration): Emitter[] {
if (configuration.hasOwnProperty('customEmitter')) {
const customEmitters = (configuration as CustomEmitter).customEmitter();
return Array.isArray(customEmitters) ? customEmitters : [customEmitters];
} else {
- 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 base64decode
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function base64decode(encodedData: string): string {
// discuss at: http://locutus.io/php/base64_decode/
// original by: Tyler Akins (http://rumkin.com)
// improved by: Thunder.m
// improved by: Kevin van Zonneveld (http://kvz.io)
- 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 findMediaElement
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function findMediaElement(id: string): SearchResult {
let el: HTMLElement | null = document.getElementById(id);
if (!el) return { err: SEARCH_ERROR.NOT_FOUND };
if (isHtmlAudioElement(el)) return { el };
- 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"