Showing 46 of 1,345 total issues
File CurlOption.ts
has 1521 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/**
* Copyright (c) Jonathan Cardoso Machado. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
File Curl.ts
has 736 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/**
* Copyright (c) Jonathan Cardoso Machado. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
Function create
has 222 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const create = (defaultOptions: CurlyOptions = {}): CurlyFunction => {
function curly<ResultData>(
url: string,
options: CurlyOptions = {},
): Promise<CurlyResult<ResultData>> {
Function create
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
Open
const create = (defaultOptions: CurlyOptions = {}): CurlyFunction => {
function curly<ResultData>(
url: string,
options: CurlyOptions = {},
): Promise<CurlyResult<ResultData>> {
- 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 curly
has 160 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function curly<ResultData>(
url: string,
options: CurlyOptions = {},
): Promise<CurlyResult<ResultData>> {
const curlHandle = new Curl()
Function onConnected
has 144 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const onConnected = (easyHandle) => {
try {
state.connectionOpen = true
// We are using this callback to listen for changes in the socket.
Function run
has 124 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const run = async () => {
const curlOptionsFilePath = path.resolve(
__dirname,
'../lib/generated/CurlOption.ts',
)
Function createAndPerformAndCloseCurlHandlesMultiTest
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
Open
function createAndPerformAndCloseCurlHandlesMultiTest() {
let i = AMOUNT_ITERATIONS_PER_RUN
let toClose: Curl[] = []
let toPerform: Curl[] = []
let currentlyPerforming: Curl[] = []
- 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 createAndPerformAndCloseCurlHandlesMultiTest
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function createAndPerformAndCloseCurlHandlesMultiTest() {
let i = AMOUNT_ITERATIONS_PER_RUN
let toClose: Curl[] = []
let toPerform: Curl[] = []
let currentlyPerforming: Curl[] = []
File curly.ts
has 308 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/**
* Copyright (c) Jonathan Cardoso Machado. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
Curl
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class Curl extends EventEmitter {
/**
* Calls [`curl_global_init()`](http://curl.haxx.se/libcurl/c/curl_global_init.html).
*
* For **flags** see the the enum {@link CurlGlobalInit | `CurlGlobalInit`}.
File 21-websockets-client.js
has 305 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/**
* Copyright (c) Jonathan Cardoso Machado. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
Function setUploadStream
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
setUploadStream(stream: Readable | null) {
if (!stream) {
if (this.readFunctionStream) {
this.cleanupReadFunctionStreamEvents()
this.readFunctionStream = null
Function defaultWriteFunctionStreamBased
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected defaultWriteFunctionStreamBased(
chunk: Buffer,
size: number,
nmemb: number,
) {
Function run
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
return function run() {
return new Promise<void>((resolve) => {
while (i--) {
console.log('creating handler')
Function createSetOptOverloads
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const createSetOptOverloads = (filePath, setOptReturnType = 'CurlCode') => {
let easyClassSetOptOverloadsData = [
getSetOptDefinition(
'DataCallbackOptions',
optionKindValueMap.dataCallback,
Function readFrame
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function readFrame(frame) {
const firstByte = frame.readUInt8(0)
const fin = ((firstByte & 0b10000000) === 0b10000000) | 0
const rs1 = firstByte & 0b01000000
Function connection
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
wss.on('connection', function connection(ws) {
let pingTimeout = null
lastSocket = ws
ws.on('message', function (message) {
console.log('ws.on - message:', message)
Function onEnd
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
onEnd() {
const isStreamResponse = !!(this.features & CurlFeature.StreamResponse)
const isDataStorageEnabled =
!isStreamResponse && !(this.features & CurlFeature.NoDataStorage)
const isDataParsingEnabled =
Function sendProtoBufMessage
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function sendProtoBufMessage(url, message) {
const curl = new Curl()
curl.setOpt('URL', url)
// enable if you want to see even more debug info
// curl.setOpt('VERBOSE', true)