Showing 201 of 626 total issues

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) {
Severity: Minor
Found in place/PlaceService.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 createInternal has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  async createInternal(context: HtmlRR0SsgContext, href: string): Promise<Source> {
    if (path.dirname(href).startsWith("/")) {
      href = href.substring(1)
    }
    const hashPos = href.lastIndexOf("#")
Severity: Minor
Found in source/SourceFactory.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 createReplacer has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  protected async createReplacer(context: HtmlRR0SsgContext): Promise<DomReplacer> {
    return {
      replace: async (itemEl: HTMLElement) => {
        if (itemEl.getAttribute("itemtype") === "https://schema.org/QuantitativeValue") {
          const propEls = Array.from(itemEl.querySelectorAll("*[itemprop]"))
Severity: Minor
Found in value/UnitReplaceCommand.ts - About 1 hr to fix

    Function createFromFullName has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      createFromFullName(fullName: string): People {
        let lastName: string
        let firstNames: string[]
        let commaPos = fullName.indexOf(",")
        if (commaPos > 0) {
    Severity: Minor
    Found in people/PeopleService.ts - About 1 hr to fix

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

        map(context: HtmlRR0SsgContext, sourceCase: UrecatCase, sourceTime: Date): RR0CaseSummary {
          const caseSource: Source = {
            events: [], previousSourceRefs: [],
            url: sourceCase.url, title: "cas n° " + sourceCase.id, authors: this.authors,
            publication: {publisher: this.copyright, time: TimeContext.fromDate(sourceTime)}
      Severity: Minor
      Found in time/datasource/urecat/UrecatRR0Mapper.ts - About 1 hr to fix

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

            protected async aggregate(context: HtmlRR0SsgContext, element: HTMLUListElement) {
              const existingCases: RR0CaseSummary[] = []
              const casesToAdd: RR0CaseSummary[] = []
              for (const mapping of this.mappings) {
                const datasource = mapping.datasource
          Severity: Minor
          Found in time/datasource/ChronologyReplacer.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

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

                  d3.f = function () {
                    var functions = arguments
                    //convert all string arguments into field accessors
                    var i = 0, l = functions.length
                    while (i < l) {
                Severity: Minor
                Found in people/a/AlammarJay/js/d3-jetpack.js - About 1 hr to fix

                  Function f has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    d3.f = function () {
                      var functions = arguments
                      //convert all string arguments into field accessors
                      var i = 0, l = functions.length
                      while (i < l) {

                    Function renderContent has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      renderContent(context: HtmlRR0SsgContext, previousContext: RR0SsgContext, options: TimeRenderOptions,
                                    renderOptions: Intl.DateTimeFormatOptions = this.textBuilder.options): {
                        result: HTMLElement,
                        replacement: HTMLElement
                      } {
                    Severity: Minor
                    Found in time/TimeRenderer.ts - About 1 hr to fix

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

                        protected async createReplacer(context: HtmlRR0SsgContext): Promise<DomReplacer> {
                          const doc = context.file.document
                          return new class implements DomReplacer {
                            async replace(original: HTMLElement): Promise<HTMLElement> {
                              if (!original.hasChildNodes()) {
                      Severity: Minor
                      Found in lang/LanguageReplaceCommand.ts - About 1 hr to fix

                        Function reluGraph has 9 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        var reluGraph = function (containerElement, xStart, xEnd, xDefault, sliderElement, reluInputElement,
                                                  reluFormulaInputElement, reluResult, reluGraphResult) {
                        Severity: Major
                        Found in people/a/AlammarJay/js/relu_graph.js - About 1 hr to fix

                          Function sigmoidGraph has 9 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          var sigmoidGraph = function (containerElement, xStart, xEnd, xDefault, sliderElement, sigmoidInputElement,
                                                       sigmoidFormulaInputElement, sigmoidResult, sigmoidGraphResult) {
                          Severity: Major
                          Found in people/a/AlammarJay/js/sigmoid_graph.js - About 1 hr to fix

                            Function getInfoStr has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              getInfoStr(context: HtmlRR0SsgContext) {
                                const authors = context.file.meta.author
                                const authorsStr = authors && authors.length > 0 ? authors.join(" & ") : ""
                            
                                let timeStr = ""
                            Severity: Minor
                            Found in OpenGraphCommand.ts - About 1 hr to fix

                              Function prev has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                              Open

                                prev(context: HtmlRR0SsgContext): Link | undefined {
                                  let fileName = context.file.name
                                  if (this.isTimeFile(fileName)) {
                                    const pos = this.timeFiles.indexOf(fileName);
                                    if (pos >= 0) {
                              Severity: Minor
                              Found in time/TimeLinkDefaultHandler.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 removeIndent has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                              Open

                                protected removeIndent(lines: string[]) {
                                  let minIndent = Number.MAX_VALUE;
                                  for (const line of lines) {
                                    if (line.length > 0) {
                                      let i = 0;
                              Severity: Minor
                              Found in tech/info/soft/proj/impl/lang/CodeReplacer.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 createReplacer has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                              Open

                                protected async createReplacer(context: HtmlRR0SsgContext): Promise<RegexReplacer> {
                                  return {
                                    replace: (_match: string, ..._args: any[]): string => {
                                      const file = context.file
                                      let authors = file.meta.author
                              Severity: Minor
                              Found in people/author/AuthorReplaceCommand.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 createFromFullName has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                              Open

                                createFromFullName(fullName: string): People {
                                  let lastName: string
                                  let firstNames: string[]
                                  let commaPos = fullName.indexOf(",")
                                  if (commaPos > 0) {
                              Severity: Minor
                              Found in people/PeopleService.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

                              Severity
                              Category
                              Status
                              Source
                              Language