Showing 109 of 313 total issues
Function compute
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
compute: function (probable) {
var zerosCount = {};
var max = 0;
var questions = self.questions;
for (var q in questions) {
Function initializeErrorGraph
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
multiVariableNeuralNetworkTrainer.prototype.initializeErrorGraph = function () {
this.error_chart_history_x = 300; // How many error data points to show
this.error_chart_history_y = 100000; // How high the bar goes
this.error_history = [10000];
Function addSpeech
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export const addSpeech = (e, lang = e.lang, text = getText(e)) => {
if (!e.classList.contains(transformed)) {
e.classList.add(transformed)
const speechEl = document.createElement('button')
speechEl.className = 'speech'
- 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 onMessageWrappers
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
const onMessageWrappers = new DefaultWeakMap(listener => {
if (typeof listener !== "function") {
return listener
}
Function graphLayerInputs
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
function graphLayerInputs(layerInputsArray, layerNumber) {
var layerInputs = layerInputsArray[layerNumber], layerInputsObjects = []
Function multiVariableNeuralNetworkTrainer
has 15 arguments (exceeds 4 allowed). Consider refactoring. Open
var multiVariableNeuralNetworkTrainer = function (numberOfInputNodes,
svg_el, table_el,
dataPoints, labels,
weights, bias,
gradientDescentButton, gradientDescent10Button, gradientDescent100Button,
Function addSpeech
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const addSpeech = (e, lang = e.lang, text = getText(e)) => {
if (!e.classList.contains(transformed)) {
e.classList.add(transformed)
const speechEl = document.createElement('button')
speechEl.className = 'speech'
Function drawGraph
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
shallowNeuralNetworkGrapher.prototype.drawGraph = function () {
var grapher = this;
this.nodeRadius = 15;
this.weightNodeWidthRatio = 1.7;
// Let's calculate our coordinates for all the nodes
- 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 graphInputToBiasLines
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
function graphInputToBiasLines(data) {
var inputToBiasLines = this.neuralNetworkG.selectAll(this.svgElement + " .input-to-bias-line")
.data(data)
Function initializeGraph
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
NN_trainer.prototype.initializeGraph = function () {
this.holder = d3.select(this.svg_el) // select the 'body' element
.append("svg") // append an SVG element to the body
.attr("width", this.graphWidth) // make the SVG element 449 pixels wide
.attr("height", 249); // make the SVG element 249 pixels high
Function onMessage
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
return function onMessage (message, sender, sendResponse) {
let didCallSendResponse = false
let wrappedSendResponse
let sendResponsePromise = new Promise(resolve => {
wrappedSendResponse = function (response) {
Function getFromRow
has 42 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 neuralNetworkCalculationViz
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
var neuralNetworkCalculationViz = function (inputs, inputNodeCount, outputNodeCount, activation, containerElement, weights, biases, tableElement,
trainingSet, classes) {
this.properties = {
Function graphWeightNodes
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
shallowNeuralNetworkGrapher.prototype.graphWeightNodes = function (data) {
var radius = this.nodeRadius * 0.6;
var t = d3.transition()
.duration(750);
Function gradientDescentStep
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
multiVariableNeuralNetworkTrainer.prototype.gradientDescentStep = function (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.weightLearningRates = [0.00000001, 0.01];
Function getWeightNodeCoordinates
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getWeightNodeCoordinates(inputLayerNodeCount,
inputNodeCount, outputNodeCount,
inputLayerCoordinates, weightLayerXCoordinates,
outputLayerCoordinates,
biasLayerX, inputLayerX) {
Function activate
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
var activate = function (d) {
if (viz.layerValues[1]) {
// Set up the tooltip to show the inputs and their sum
var rows = "<table class=\"softmax-calculation\">", total = 0
rows = rows + "<tr>" +
Function findPeople
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
window.findPeople = (_e) => {
const value = normalize(textInput.value)
const list = document.querySelector("#searchForm + ul")
let found = 0
const selectedCountries = countryInputs.filter(countryInput => countryInput.checked)
- 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 graphBiasToSoftmaxArrows
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function graphBiasToSoftmaxArrows(data) {
var inputToBiasLines = this.neuralNetworkG.selectAll(this.svgElement + " .bias-to-softmax-line")
.data(data)
Function graphBiasToSoftmaxArrows
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
shallowNeuralNetworkGrapher.prototype.graphBiasToSoftmaxArrows = function (data) {
var inputToBiasLines = this.neuralNetworkG.selectAll(this.svgElement + " .bias-to-softmax-line")
.data(data);
inputToBiasLines.exit()