Showing 163 of 559 total issues

Function createReplacer has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  protected async createReplacer(context: HtmlRR0SsgContext): Promise<DomReplacer<HTMLImageElement>> {
    return {
      replace: async (imgEl: HTMLImageElement): Promise<HTMLImageElement> => {
        const src = imgEl.src;
        const imgParentEl = imgEl.parentElement;
Severity: Major
Found in ImageCommand.ts - About 2 hrs to fix

    File PeopleDirectoryStep.ts has 256 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { Occupation } from "./Occupation"
    import { Time } from "../time/Time"
    import { KnownPeople, People } from "./People"
    import { promise as glob } from "glob-promise"
    import { HtmlRR0SsgContext } from "../RR0SsgContext"
    Severity: Minor
    Found in people/PeopleDirectoryStep.ts - About 2 hrs to fix

      File sw.js has 255 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      const version = '0.1.0'
      let serverUrl
      // Cache IDs
      let coreID = `core_${version}`
      let pageID = `pages_${version}`
      Severity: Minor
      Found in public/sw.js - About 2 hrs to fix

        Function processDirs has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          protected async processDirs(context: HtmlRR0SsgContext, dirNames: string[]): Promise<void> {
            let peopleList = await this.service.getPeopleFromDirs(context, dirNames)
            if (this.filterOccupations.length > 0) {
              peopleList = peopleList.filter((p: People) => p.occupations.some(o => this.filterOccupations.includes(o)))
            }
        Severity: Major
        Found in people/PeopleDirectoryStep.ts - About 2 hrs to fix

          Function replacement has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

            async replacement(context: HtmlRR0SsgContext, original: HTMLTimeElement): Promise<HTMLElement> {
              let replacement: HTMLElement | undefined
              if (original.dateTime) {  // Already done?
                replacement = original
              } else {
          Severity: Minor
          Found in time/TimeReplacer.ts - About 2 hrs 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 initializeTable has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            neuralNetworkCalculationViz.prototype.initializeTable = function (trainingSet) {
          
          
              var viz = this
              var table = d3.select(this.tableElement)
          Severity: Major
          Found in people/a/AlammarJay/js/nn_calc.js - About 2 hrs to fix

            Function replace has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  replace: async (imgEl: HTMLImageElement): Promise<HTMLImageElement> => {
                    const src = imgEl.src;
                    const imgParentEl = imgEl.parentElement;
                    if (imgParentEl.tagName === 'FIGURE') {
                      const captionEl = imgParentEl.querySelector('figcaption');
            Severity: Major
            Found in ImageCommand.ts - About 2 hrs to fix

              Function build has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                static build(context: RR0SsgContext, print = true): string {
                  const time = context.time
                  const printOptions: Intl.DateTimeFormatOptions = {}
                  const date = new Date(undefined, undefined, undefined)
                  const year = time.getYear()
              Severity: Minor
              Found in time/TimeTextBuilder.ts - About 2 hrs to fix

                Function getPeopleFromDir has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  async getPeopleFromDir(context: RR0SsgContext, dirName: string): Promise<People[]> {
                    let peopleList: People[] = []
                    const fileSpec = `/people*.json`
                    const files = await glob(`${dirName}${fileSpec}`)
                    for (const file of files) {
                Severity: Minor
                Found in people/PeopleService.ts - About 1 hr to fix

                  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) {
                  Severity: Minor
                  Found in time/1/9/7/7/Poher_Matrice/matrix.js - About 1 hr to fix

                    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) {
                    Severity: Minor
                    Found in time/1/9/7/7/Poher_Matrice/matrix.es5.js - About 1 hr to fix

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

                        Function addSpeech has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                        Open

                        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'
                        Severity: Minor
                        Found in index/lang.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 graphLayerInputs has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          function graphLayerInputs(layerInputsArray, layerNumber) {
                        
                        
                            var layerInputs = layerInputsArray[layerNumber], layerInputsObjects = []
                        
                        
                        Severity: Minor
                        Found in people/a/AlammarJay/js/nn_calc.js - About 1 hr to fix

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

                            Function addSpeech has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

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

                              Function getFromRow has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                protected async getFromRow(context: RR0SsgContext, row: Element): Promise<UfoSearchCase> {
                                  const fieldsHeadings = Array.from(row.querySelectorAll("strong"))
                                  const dateLabel = fieldsHeadings.find(heading => heading.textContent.indexOf("Date") >= 0)
                                  const itemContext = context.clone()
                                  const dateTime = itemContext.time.reset()
                              Severity: Minor
                              Found in time/datasource/ufo-search/UfoSearchHttpDatasource.ts - About 1 hr to fix

                                Function constructor has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  constructor(criteria = "", allowEmpty = true) {
                                    this.criteria = criteria
                                    this.allowEmpty = allowEmpty
                                    this.matchers = []
                                    const andCriterions = criteria.split("&")
                                Severity: Minor
                                Found in udb/match.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 thisSourceElement has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  protected thisSourceElement(context: HtmlRR0SsgContext, source: Source) {
                                    const sourceEl = context.outputFile.document.createElement("span")
                                    sourceEl.className = "source"
                                    sourceEl.append(source.authors?.join(" & "), `: `)
                                    const doc = context.outputFile.document
                                Severity: Minor
                                Found in time/RR0CaseRenderer.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 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
                                Severity: Minor
                                Found in people/a/AlammarJay/js/shallow_nn_grapher.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

                                Severity
                                Category
                                Status
                                Source
                                Language