Showing 166 of 560 total issues
Function graphSoftmaxToOutputArrows
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
shallowNeuralNetworkGrapher.prototype.graphSoftmaxToOutputArrows = function (data) {
var inputToBiasLines = this.neuralNetworkG.selectAll(this.svgElement + " .softmax-to-output-line").data(data);
inputToBiasLines.exit().remove();
Function drawGraphOld
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
neuralNetworkCalculationViz.prototype.drawGraphOld = function () {
var grapher = this
// Let's calculate our coordinates for all the nodes
// Let's start with the X coordiantes for each layer
Function createReplacer
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected async createReplacer(context: HtmlRR0SsgContext): Promise<RegexReplacer> {
return {
replace: (_match: string, ..._args: any[]): string => {
const SsgFile = context.inputFile
let authors = SsgFile.meta.author
- 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 setTimeContextFrom
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
static setTimeContextFrom(timeContext: TimeContext, parsed: TimeParseResult) {
if (parsed.yearStr) {
const year = parseInt(parsed.yearStr, 10)
if (!Number.isNaN(year)) {
timeContext.setYear(year)
- 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 activate
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
var activate = function (d) {
console.log("INSIDE", viz.layerValues[1])
if (viz.layerValues[1]) {
// Set up the tooltip to show the inputs and their sum
var rows = "<table class=\"softmax-calculation\">", total = 0,
Function getWitnesses
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
getWitnesses(witnessesStr: string): UrecatWitness[] {
let lastName = ""
const andNames = witnessesStr
.split(" et ")
.flatMap(and => and.split(","))
Function graphOutputNodes
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
shallowNeuralNetworkGrapher.prototype.graphOutputNodes = function (data) {
// JOIN
var inputGroups = this.neuralNetworkG.selectAll(this.svgElement + " .output-group")
.data(data);
Function graphInputNodes
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
shallowNeuralNetworkGrapher.prototype.graphInputNodes = function (data) {
// JOIN
var inputGroups = this.neuralNetworkG.selectAll(this.svgElement + " .input-group").data(data);
// EXIT old elements not present in new data.
Function graphBiasNodes
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
shallowNeuralNetworkGrapher.prototype.graphBiasNodes = function (data) {
// JOIN
var biasNodes = this.neuralNetworkG.selectAll(this.svgElement + " .bias-group").data(data);
// EXIT old elements not present in new data.
Function onclick
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
speechEl.onclick = (e) => {
e.preventDefault()
e.stopPropagation()
const anotherSpeech = speechMsg && speechMsg.text !== text
if (!speechMsg || anotherSpeech) {
Function durationReplacement
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected durationReplacement(
context: HtmlRR0SsgContext, daysStr: string, hoursStr: string, minutesStr: string, secondsStr: string
): HTMLTimeElement | undefined {
const items = []
const messages = context.messages.context.time.duration
Function getFromRow
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected getFromRow(context: RR0SsgContext, row: Element): GeipanCaseSummary {
const linkField = row.querySelector(".fiche-download-icon")
const caseLink = linkField.firstElementChild as HTMLAnchorElement
const url = new URL(caseLink.href, this.baseUrl)
const caseField = row.querySelector(".cas_title")
Function draw
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
draw: function (layer, properties, activeRegionSVGGroup) {
// JOIN
// Each node has an SVG group of its own. In that group is an SVG circle and SVG text label
var nodeGroups = activeRegionSVGGroup.selectAll(properties.containerElement + " .layer-" + layer.index)
Function find
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
find(context: RR0SsgContext, nameToFind: string, parent: P): Organization | undefined {
let foundOrg = this.orgs.find(org => {
const orgMessages = org.messages(context)
assert.ok(orgMessages, `Organization with code "${org.code}" has no messages`)
let found: boolean
- 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 updateUI
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
NN_trainer.prototype.updateUI = function (mean_delta_sum, errorLineValues) {
//Update error chart if available
if (this.error_chart_el !== "")
this.addErrorPoint(mean_delta_sum);
- 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 updateTimeFromStr
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
static updateTimeFromStr(time: TimeContext, timeStr: string) {
const result = TimeReplacer.parseDateTime(timeStr)
if (result) {
const {yearStr, monthStr, dayOfMonthStr, hour, minutes, timeZone} = result
time.setYear(parseInt(yearStr, 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 neuralNetworkCalculationViz
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
var neuralNetworkCalculationViz = function (inputs, inputNodeCount, outputNodeCount, activation, containerElement, weights, biases, tableElement,
trainingSet, classes) {
Function get
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
async get(address: string): Promise<Place | undefined> {
let place = this.cache.get(address)
if (!place) {
place = await this.create(address)
if (place) {
- 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 getNativeCase
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected getNativeCase(context: RR0SsgContext, row: Element): AcufoCase {
const fields = row.querySelectorAll("td")
const caseLink = fields[0].firstElementChild as HTMLAnchorElement
const dateFormat = /(\d\d)\/(\d\d)\/(\d\d\d\d) (\d\d):(\d\d)/
const dateFields = dateFormat.exec(fields[1].textContent)
Function gradientDescentStep
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
NN_trainer.prototype.gradientDescentStep = function (number_of_steps) {
// I probably shouldn't do this. I started doing feature normalization so we can keep to one learning rate.
// I decided to do it this way to maintain narrative continuity.
this.learningRate = 0.00000001;