JCMais/node-libcurl

View on GitHub

Showing 46 of 1,345 total issues

Function setUploadStream has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  setUploadStream(stream: Readable | null) {
    if (!stream) {
      if (this.readFunctionStream) {
        this.cleanupReadFunctionStreamEvents()
        this.readFunctionStream = null
Severity: Minor
Found in lib/Curl.ts - About 45 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 onEnd has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  onEnd() {
    const isStreamResponse = !!(this.features & CurlFeature.StreamResponse)
    const isDataStorageEnabled =
      !isStreamResponse && !(this.features & CurlFeature.NoDataStorage)
    const isDataParsingEnabled =
Severity: Minor
Found in lib/Curl.ts - About 45 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 fileIsComing has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function fileIsComing(fileInfo, remains) {
  console.log(
    util.format(
      'Remaining entries: %d / Current: %s / Size: %d - ',
      remains,
Severity: Minor
Found in examples/16-ftp-wildcard-fnmatch.js - 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 gracefulShutdown has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function gracefulShutdown(server, options = {}) {
  const {
    gracePeriod = process.env.GRACEFUL_SHUTDOWN_GRACE_PERIOD_MS || 5000,
    onShutdown = noopFn,
  } = options
Severity: Minor
Found in examples/19-binary-data-protobuf/gracefulShutdown.js - 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 dupHandle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  dupHandle(shouldCopyEventListeners = true) {
    const duplicatedHandle = new Curl(this.handle.dupHandle())
    const eventsToCopy = ['end', 'error', 'data', 'header']

    duplicatedHandle.features = this.features
Severity: Minor
Found in lib/Curl.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const run = async () => {
  const curlOptionsFilePath = path.resolve(
    __dirname,
    '../lib/generated/CurlOption.ts',
  )
Severity: Minor
Found in scripts/build-constants.js - 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