Showing 166 of 560 total issues
Function join
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
static join(first: string, second: string): string {
const firstEndsWithSlash = first.endsWith("/")
const secondStartsWithSlash = second.startsWith("/")
if (firstEndsWithSlash) {
return secondStartsWithSlash ? first + second.substring(1) : first + second
- 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 fetch
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async fetch<T>(url: string, init: RequestInit = {}, resOut = {}): Promise<T> {
init.headers = Object.assign({"User-Agent": this.randomUA()}, init.headers)
console.debug("Fetching", url, "with", init)
const response = await fetch(url, init)
if (response.ok) {
- 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 getSoftmaxtoOutputLinesData
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function getSoftmaxtoOutputLinesData(outputNodeCount, activationLayerX, nodeRadius, outputLayerCoordinates,
outputLayerX, classes) {
Avoid deeply nested control flow statements. Open
for (let i = 0; i < dictWord.length; i++, matchStart++) {
const dictWordChar = dictWord.charAt(i)
const fileWordChar = contents.charAt(pos + matchStart)
if (fileWordChar === badChar) {
score += 5
Avoid deeply nested control flow statements. Open
if (choice.value !== false) {
var knownPhenomenaProbabilities = choice.knownPhenomenaProbabilities;
for (var p in knownPhenomenaProbabilities) {
if (knownPhenomenaProbabilities.hasOwnProperty(p)) {
if (!zerosCount[p]) {
Avoid deeply nested control flow statements. Open
if (choice.value !== false) {
var knownPhenomenaProbabilities = choice.knownPhenomenaProbabilities
for (var p in knownPhenomenaProbabilities) {
if (knownPhenomenaProbabilities.hasOwnProperty(p)) {
if (!zerosCount[p]) {
Function processDirs
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected async processDirs(context: HtmlRR0SsgContext, dirNames: string[]): Promise<void> {
let peopleList = await this.service.getFromDirs(context, dirNames)
if (this.filterOccupations.length > 0) {
peopleList = peopleList.filter((p: People) => p.occupations.some(o => this.filterOccupations.includes(o)))
}
- 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 testCase
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function testCase(urlPath: string, dateTime: TimeContext, description: string, sources: Source[],
place?: NamedPlace): RR0CaseSummary {
Function getLayerXScale
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function getLayerXScale(numberOfLayers, layersRegionWidth, outputRegionWidth, marginLeft, nodeRadius) {
Function draw
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
draw: function (layer, properties, activeRegionSVGGroup, layerInputs, tooltipDiv) {
Function replaceItem
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected replaceItem(context: HtmlRR0SsgContext, item: HTMLLIElement, i: number) {
const anchor = item.querySelector(".index-anchor")
if (!anchor) {
const idOrValue = item.getAttribute("id") || item.getAttribute("value")
let dateTime: 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
Function drawImage
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected async drawImage(context: HtmlRR0SsgContext, canvasCtx: CanvasRenderingContext2D, dy = 0) {
const outDoc = context.outputFile.document
const docImages = outDoc.documentElement.getElementsByTagName("img")
let widthRatio = 0.5
let imageIndex = 0
- 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 update
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async update(parent?: Chapter) {
const file = this.context.outputFile;
const meta = file.meta;
const links = file.links;
if (parent) {
- 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 fromFileName
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
static fromFileName(context: HtmlRR0SsgContext, fileName = context.inputFile.name): TimeContext | undefined {
let timeContext: TimeContext | undefined
const timeExec = Time.parseFileName(fileName)
if (timeExec && timeExec.length > 5) {
const pageContext = context.clone()
- 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 NN_trainer
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
var NN_trainer = function (svg_el, table_el, areas, prices, weight, bias, x1, y1, x2, y2,
gradientDescentButton, gradientDescent10Button, gradientDescent100Button,
gradientDescentConvergeButton, normalize, error_chart_el, heatmap_el,
weightRange, biasRange, neuralNetworkGraphEl, analyticsCategory) {
this.svg_el = svg_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"
Further reading
Function indexWords
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected indexWords(context: HtmlRR0SsgContext, outputFile: HtmlSsgFile) {
const pageIndex = this.index.pages.length;
const nonSignificant = context.messages.nonSignificantWords;
const contents = this.getContents(outputFile.document);
const pageText = contents.toLowerCase();
- 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 execute
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async execute(context: C): Promise<HtmlSsgFile> {
const inputFile = context.inputFile
const outputFile = context.outputFile
const dom = outputFile.dom
const outputDoc = outputFile.document;
- 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 value.toExponential(1);
Function replaceElement
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static replaceElement(context: HtmlRR0SsgContext, timeFiles: string[], previousContext?: RR0SsgContext): HTMLElement {
let replacement: HTMLElement | undefined
const absoluteTimeStr = TimeUrlBuilder.fromContext(context)
let title = TimeTextBuilder.build(context)
let text = previousContext ? RelativeTimeTextBuilder.build(previousContext, context) : undefined
- 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 createReplacer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected async createReplacer(context: HtmlRR0SsgContext): Promise<RegexReplacer> {
return {
replace: (_match: string, ..._args: any[]): string => {
const inputFile = context.inputFile
let title = inputFile.title
- 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"