Darkhogg/polyethylene

View on GitHub

Showing 14 of 42 total issues

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

function * sliceNegPosGen<T> (iter: Iterable<T>, start: number, end: number): Iterable<T> {
  const buf = Array(start)
  let pos = 0
  let size = 0
  let num = end
Severity: Minor
Found in src/lib/sync/generators.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 sliceNegPosGen has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

async function * sliceNegPosGen<T> (iter: AsyncIterable<T>, start: number, end: number): AsyncIterable<T> {
  const buf = Array(start)
  let pos = 0
  let size = 0
  let num = end
Severity: Minor
Found in src/lib/async/generators.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 dropLastGen has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export function * dropLastGen<T> (iter: Iterable<T>, num: number): Iterable<T> {
  const buf = Array(num)
  let pos = 0
  let size = 0
  for (const elem of iter) {
Severity: Minor
Found in src/lib/sync/generators.ts - About 55 mins 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 dropLastGen has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export async function * dropLastGen<T> (iter: AsyncIterable<T>, num: number): AsyncIterable<T> {
  const buf = Array(num)
  let pos = 0
  let size = 0
  for await (const elem of iter) {
Severity: Minor
Found in src/lib/async/generators.ts - About 55 mins 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 takeLastGen has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export async function * takeLastGen<T> (iter: AsyncIterable<T>, num: number): AsyncIterable<T> {
  const buf = Array(num)
  let pos = 0
  let size = 0
  for await (const elem of iter) {
Severity: Minor
Found in src/lib/async/generators.ts - About 35 mins 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 takeLastGen has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function * takeLastGen<T> (iter: Iterable<T>, num: number): Iterable<T> {
  const buf = Array(num)
  let pos = 0
  let size = 0
  for (const elem of iter) {
Severity: Minor
Found in src/lib/sync/generators.ts - About 35 mins 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 sliceGen has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function sliceGen<T> (iter: Iterable<T>, start: number, end?: number): Iterable<T> {
  if (start >= 0 && end == null) {
    return dropGen(iter, start)
  } else if (end == null) { // && start < 0
    return takeLastGen(iter, -start)
Severity: Minor
Found in src/lib/sync/generators.ts - About 35 mins 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

Avoid too many return statements within this function.
Open

    return dropLastGen(dropGen(iter, start), -end)
Severity: Major
Found in src/lib/async/generators.ts - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return dropLastGen(takeLastGen(iter, -start), -end)
    Severity: Major
    Found in src/lib/async/generators.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return dropLastGen(takeLastGen(iter, -start), -end)
      Severity: Major
      Found in src/lib/sync/generators.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return dropLastGen(dropGen(iter, start), -end)
        Severity: Major
        Found in src/lib/sync/generators.ts - About 30 mins to fix

          Function sliceGen has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          export function sliceGen<T> (iter: AsyncIterable<T>, start: number, end?: number): AsyncIterable<T> {
            if (start >= 0 && end == null) {
              return dropGen(iter, start)
            } else if (end == null) { // && start < 0
              return takeLastGen(iter, -start)
          Severity: Minor
          Found in src/lib/async/generators.ts - About 25 mins 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 Symbol.asyncIterator has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            [Symbol.asyncIterator] (): AsyncIterator<T> {
              const outerThis = this
          
              return {
                next (): Promise<IteratorResult<T>> {
          Severity: Minor
          Found in src/lib/builder.ts - About 25 mins 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 chunkWhileGen has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          export async function * chunkWhileGen<T> (
            iter: AsyncIterable<T>,
            func: AsyncChunkingPredicate<T>,
          ): AsyncIterable<Array<T>> {
            let chunk: Array<T> = []
          Severity: Minor
          Found in src/lib/async/generators.ts - About 25 mins 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