Showing 555 of 555 total issues

Similar blocks of code found in 3 locations. Consider refactoring.
Open

      if (!dayOfMonth) {
        switch (monthDelta) {
          case -1:
            text = messages.month.before
            break
Severity: Major
Found in time/RelativeTimeTextBuilder.ts and 2 other locations - About 1 hr to fix
time/RelativeTimeTextBuilder.ts on lines 131..140
time/RelativeTimeTextBuilder.ts on lines 141..150

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 57.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

      if (!month) {
        switch (yearDelta) {
          case -1:
            text = messages.year.before
            break
Severity: Major
Found in time/RelativeTimeTextBuilder.ts and 2 other locations - About 1 hr to fix
time/RelativeTimeTextBuilder.ts on lines 121..130
time/RelativeTimeTextBuilder.ts on lines 141..150

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 57.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

  protected replaceItem(context: HtmlRR0SsgContext, item: HTMLLIElement, i: number): number {
    const anchor = item.querySelector(".index-anchor")
    let nextIndex: number
    if (!anchor) {
      const value = item.getAttribute("value")
Severity: Minor
Found in index/indexedReplacer.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 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 createFromFullName has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  createFromFullName(fullName: string): KnownPeople {
    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

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

  async execute(context: HtmlRR0SsgContext): Promise<void> {
    const file = context.file
    const title = file.title
    const outDir = "out/"
    const url = file.name.startsWith(outDir) ? file.name.substring(outDir.length) : file.name
Severity: Minor
Found in search/SearchCommand.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 getFromRow has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  protected getFromRow(context: RR0SsgContext, row: Element): FuforaCaseSummary {
    const fields = row.querySelectorAll("div")
    const caseLink = fields[0].firstElementChild as HTMLAnchorElement
    const dateFormat = /(?:(\d\d).(\d\d).(\d\d\d\d))?\n?(.+)?/
    const dateFields = dateFormat.exec(fields[1].textContent)
Severity: Minor
Found in time/datasource/fufora/FuforaHttpDatasource.ts - About 1 hr to fix

    Function getSources has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      protected getSources(row: Element, itemContext: HtmlRR0SsgContext): Source[] {
        const sources: Source[] = []
        const sourceEls = row.querySelectorAll(".source-id")
        for (const sourceEl of sourceEls) {
          const id = sourceEl.childNodes[0].textContent
    Severity: Minor
    Found in time/datasource/rr0/RR0HttpDatasource.ts - About 1 hr to fix

      Function findPeople has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      window.findPeople = (_e) => {
        const textInput = form.querySelector('input[type=\'search\']')
      
        function normalize (str) {
          return str.toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g, '').trim()
      Severity: Minor
      Found in people/index.js - About 1 hr to fix

        Function execute has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          async execute(context: HtmlRR0SsgContext): Promise<void> {
            const file = context.file
            const inDescription = file.meta.description
            const outDoc = file.document
            let descriptionMeta = outDoc.head.querySelector("meta[name='description']")
        Severity: Minor
        Found in DescriptionReplaceCommand.ts - About 1 hr to fix

          Function setTimeContextFrom has 27 lines of code (exceeds 25 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)
          Severity: Minor
          Found in time/TimeReplacer.ts - About 1 hr to fix

            Function readCases has 27 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 time/datasource/geipan/GeipanHttpDatasource.ts - About 1 hr to fix

              Function drawImage has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                protected async drawImage(context: HtmlRR0SsgContext, canvasCtx: CanvasRenderingContext2D, dy = 0) {
                  const outDoc = context.file.document
                  const docImages = outDoc.documentElement.getElementsByTagName("img")
                  let widthRatio = 0.5
                  let imageIndex = 0
              Severity: Minor
              Found in OpenGraphCommand.ts - About 1 hr to fix

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

                  createFromFullName(fullName: string): KnownPeople {
                    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 indexWords has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    protected indexWords(context: HtmlRR0SsgContext, outputFile: HtmlSsgFile) {
                      const pageIndex = this.index.pages.length
                      const nonSignificant = context.messages.nonSignificantWords
                      const contents = this.getContents(outputFile.document)
                      const pageText = contents.toLowerCase()
                  Severity: Minor
                  Found in search/SearchCommand.ts - About 1 hr to fix

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                      this.g.append("g")
                        .attr("class", "axis axis--y")
                        .call(d3.axisLeft(this.y).ticks(5));
                    Severity: Major
                    Found in people/a/AlammarJay/js/simple_nn.js and 1 other location - About 1 hr to fix
                    people/a/AlammarJay/js/simple_nn.js on lines 584..586

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 56.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                      this.errorG.selectAll(this.svg_el + " .axis--y .tick text")
                        .attr("fill", function (d) {
                          return this.errorGraphScale(d)
                        }.bind(this))
                    Severity: Major
                    Found in people/a/AlammarJay/js/two_variable_nn.js and 1 other location - About 1 hr to fix
                    people/a/AlammarJay/js/simple_nn.js on lines 324..327

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 56.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                      this.heatmapG.append("g")
                        .attr("class", "axis axis--y")
                        .call(d3.axisLeft(this.heatmapYAxisScale).ticks(5));
                    Severity: Major
                    Found in people/a/AlammarJay/js/simple_nn.js and 1 other location - About 1 hr to fix
                    people/a/AlammarJay/js/simple_nn.js on lines 165..167

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 56.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                      this.errorG.selectAll(this.error_chart_el + " .axis--y .tick text")
                        .attr("fill", function (d) {
                          return this.errorGraphScale(d)
                        }.bind(this))
                    Severity: Major
                    Found in people/a/AlammarJay/js/simple_nn.js and 1 other location - About 1 hr to fix
                    people/a/AlammarJay/js/two_variable_nn.js on lines 256..259

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 56.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Severity
                    Category
                    Status
                    Source
                    Language