Showing 109 of 313 total issues

Function graphSoftmaxOutputs has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function graphSoftmaxOutputs(softmaxOutputs) {
    var grapher = this
    var data = []
    for (var i = 0; i < this.softmaxOutputs.length; i++) {
      data.push({
Severity: Minor
Found in people/a/AlammarJay/js/nn_calc.js - About 1 hr to fix

    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();
    Severity: Minor
    Found in people/a/AlammarJay/js/shallow_nn_grapher.js - About 1 hr to fix

      Function graphInputToBiasLines has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      shallowNeuralNetworkGrapher.prototype.graphInputToBiasLines = function (data) {
        var inputToBiasLines = this.neuralNetworkG.selectAll(this.svgElement + " .input-to-bias-line")
          .data(data);
      
        inputToBiasLines.exit()
      Severity: Minor
      Found in people/a/AlammarJay/js/shallow_nn_grapher.js - About 1 hr to fix

        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
        Severity: Minor
        Found in people/a/AlammarJay/js/nn_calc.js - About 1 hr to fix

          Function process has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            protected async process(context: HtmlRR0SsgContext, data: RR0Data) {
              this.processTitle(context, data)
              this.processURL(context, data)
              const events = data.events.sort(
                (event1, event2) => event1.time ? event2.time ? event1.time.isBefore(event2.time) ? -1 : 1 : -1 : 1)
          Severity: Minor
          Found in DefaultContentVisitor.ts - About 1 hr to fix

          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 get has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                    get (proxyTarget, prop, receiver) {
                      if (prop in cache) {
                        return cache[prop]
                      }
                      if (!(prop in target)) {
          Severity: Minor
          Found in extension/Shared (Extension)/Resources/browser-polyfill.js - About 1 hr to fix

            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,
            Severity: Minor
            Found in people/a/AlammarJay/js/nn_calc.js - About 1 hr to fix

              Function fileSearchChange has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function fileSearchChange (e) {
                tableBody.innerHTML = ""
                const input = (fileSearchInput.value || "").toLowerCase().trim()
              
                /**
              Severity: Minor
              Found in tech/info/soft/data/doc/index.js - About 1 hr to fix

                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.
                Severity: Minor
                Found in people/a/AlammarJay/js/shallow_nn_grapher.js - About 1 hr to fix

                  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);
                  
                  
                  Severity: Minor
                  Found in people/a/AlammarJay/js/shallow_nn_grapher.js - About 1 hr to fix

                    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) {
                    Severity: Minor
                    Found in lang/speech.js - About 1 hr to fix

                      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.
                      Severity: Minor
                      Found in people/a/AlammarJay/js/shallow_nn_grapher.js - About 1 hr to fix

                        Function wrapAsyncFunction has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              const wrapAsyncFunction = (name, metadata) => {
                                return function asyncFunctionWrapper (target, ...args) {
                                  if (args.length < metadata.minArgs) {
                                    throw new Error(`Expected at least ${metadata.minArgs} ${pluralizeArguments(metadata.minArgs)} for ${name}(), got ${args.length}`)
                                  }
                        Severity: Minor
                        Found in extension/Shared (Extension)/Resources/browser-polyfill.js - About 1 hr to fix

                          Function readCases has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            protected async readCases(context: RR0SsgContext): Promise<GeipanCaseSummary[]> {
                              const time = context.time
                              const day = time.getDayOfMonth()
                              const dayStartStr = day ? String(day).padStart(2, "0") : "01"
                              const dayEndStr = day ? String(day).padStart(2, "0") : "31"
                          Severity: Minor
                          Found in org/eu/fr/cnes/geipan/GeipanHttpDatasource.ts - About 1 hr to fix

                            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)
                            Severity: Minor
                            Found in people/a/AlammarJay/js/nn_calc.js - About 1 hr to fix

                              Function neuralNetworkCalculationViz has 10 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                var neuralNetworkCalculationViz = function (inputs, inputNodeCount, outputNodeCount, activation, containerElement, weights, biases, tableElement,
                                                                            trainingSet, classes) {
                              Severity: Major
                              Found in people/a/AlammarJay/js/nn_calc.js - About 1 hr to fix

                                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);
                                Severity: Minor
                                Found in people/a/AlammarJay/js/simple_nn.js - About 1 hr to fix

                                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 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;
                                Severity: Minor
                                Found in people/a/AlammarJay/js/simple_nn.js - About 1 hr to fix

                                  Function handleImage has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    private handleImage(context: HtmlRR0SsgContext, imageUrl: string) {
                                      const inputFile = context.file.name
                                      if (imageUrl) {
                                        const isLocal = !imageUrl.startsWith("http")
                                        if (isLocal) {
                                  Severity: Minor
                                  Found in ImageCommand.ts - About 1 hr to fix

                                    Function asyncFunctionWrapper has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                            return function asyncFunctionWrapper (target, ...args) {
                                              if (args.length < metadata.minArgs) {
                                                throw new Error(`Expected at least ${metadata.minArgs} ${pluralizeArguments(metadata.minArgs)} for ${name}(), got ${args.length}`)
                                              }
                                              if (args.length > metadata.maxArgs) {
                                    Severity: Minor
                                    Found in extension/Shared (Extension)/Resources/browser-polyfill.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language