Showing 46 of 1,345 total issues
Function parseHeaders
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export function parseHeaders(headersString: string): HeaderInfo[] {
const headers = headersString.split(/\r?\n|\r/g)
const len = headers.length
const result = []
- Read upRead up
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 readFrame
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function readFrame(frame) {
const firstByte = frame.readUInt8(0)
const fin = ((firstByte & 0b10000000) === 0b10000000) | 0
const rs1 = firstByte & 0b01000000
- Read upRead up
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 defaultWriteFunctionStreamBased
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected defaultWriteFunctionStreamBased(
chunk: Buffer,
size: number,
nmemb: number,
) {
- Read upRead up
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 cb
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
function cb(code) {
const { data } = this
const now = Date.now()
let shouldWrite = false
Function attachPackageToRelease
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function attachPackageToRelease(pckg, release) {
const packagePath = path.resolve(pckg)
if (!fs.existsSync(packagePath)) {
throw new Error(
Function sendData
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function sendData(handle, buffer) {
let bufferToSend = buffer
while (bufferToSend) {
const { code, bytesSent } = handle.send(bufferToSend)
- Read upRead up
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 receiveData
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function receiveData(handle, bufferSize = 32 * 1024) {
const buffers = []
// eslint-disable-next-line no-constant-condition
while (true) {
- Read upRead up
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 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function fileIsComing(fileInfo, remains) {
console.log(
util.format(
'Remaining entries: %d / Current: %s / Size: %d - ',
remains,
Function removePackageFromRelease
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function removePackageFromRelease(packageToDelete, release) {
const packageToDeleteName = path.basename(packageToDelete)
let found = false
Function createAndCloseCurlHandlesTest
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createAndCloseCurlHandlesTest() {
let i = 0
const shouldClose = iteration++ % 2
const postData = [
{
Function parseHeaders
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function parseHeaders(headersString: string): HeaderInfo[] {
const headers = headersString.split(/\r?\n|\r/g)
const len = headers.length
const result = []
Function run
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
const run = async () => {
try {
// there are many ways to use the curly.* functions
let response = null
Function run
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
const run = async () => {
// the files we are going to read and write
const uploadFilePath = './100mb.in.data.zip'
const downloadFilePath = './100mb.out.data.zip'
Function retrieveWinDeps
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
const retrieveWinDeps = async () => {
const fileExists = fs.existsSync(fileWithDepsTag)
if (!fileExists && !envCurlForWindowsDepsVersionTag) {
console.error(
Function packFrame
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function packFrame(data, type) {
const length = data.length
// initial offset is 6
// 1 byte for the first part (fin, rsvn, opcode)
// 1 byte for the mask and payload length(first part)
Function debugCallback
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const debugCallback = (infoType, content) => {
let text = ''
const contentString = content.toString('utf8')
Function gracefulShutdown
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function gracefulShutdown(server, options = {}) {
const {
gracePeriod = process.env.GRACEFUL_SHUTDOWN_GRACE_PERIOD_MS || 5000,
onShutdown = noopFn,
} = options
Function replaceTokensOnFiles
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function replaceTokensOnFiles(dir) {
const filesToCheck = [
'libssh2.gyp',
'openssl/openssl.gyp',
'cares/cares.gyp',
Function setOpt
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
setOpt(optionIdOrName: never, optionValue: never): this {
// special case for WRITEFUNCTION and HEADERFUNCTION callbacks
// since if they are set back to null, we must restore the default callback.
let value = optionValue
if (
- Read upRead up
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 =
- Read upRead up
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"