Showing 18 of 100 total issues
Function FaasReactClient
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
export function FaasReactClient({
domain,
options,
onError,
}: FaasReactClientOptions): FaasReactClientInstance {
- 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 transferValue
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
export function transferValue(type: FaasItemType, value: any): any {
if (!type) type = 'string'
if (
!type.endsWith('[]') &&
- 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
File index.ts
has 286 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* FaasJS's request module.
*
* [![License: MIT](https://img.shields.io/npm/l/@faasjs/request.svg)](https://github.com/faasjs/faasjs/blob/main/packages/faasjs/request/LICENSE)
* [![NPM Version](https://img.shields.io/npm/v/@faasjs/request.svg)](https://www.npmjs.com/package/@faasjs/request)
Function publish
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
async function publish(path) {
const pkg = require(`${__dirname}/${path}`)
console.log(pkg.name)
- 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
Consider simplifying this complex logical expression. Open
if (
response.body &&
response.headers['content-type'] &&
response.headers['content-type'].includes('application/json') &&
typeof response.body === 'string' &&
Avoid deeply nested control flow statements. Open
if (shouldMerge(value)) val = deepMerge(acc[key], value)
else val = value
Avoid deeply nested control flow statements. Open
for (const val of value)
this.validContent(
type,
val,
baseKey ? `${baseKey}.${key}.` : `${key}.`,
Avoid deeply nested control flow statements. Open
switch (rule.type) {
case 'array':
typed = Array.isArray(value)
break
case 'object':
Avoid deeply nested control flow statements. Open
else if (typeof value === 'object')
// object
this.validContent(
type,
value,
Avoid deeply nested control flow statements. Open
for (const val of value)
this.validContent(
type,
val,
baseKey ? `${baseKey}.${key}.` : `${key}.`,
Avoid deeply nested control flow statements. Open
else if (typeof value === 'object')
// object
this.validContent(
type,
value,
Avoid deeply nested control flow statements. Open
switch (rule.type) {
case 'array':
typed = Array.isArray(value)
break
case 'object':
Consider simplifying this complex logical expression. Open
if (
!type.endsWith('[]') &&
(typeof value === 'undefined' ||
value === null ||
value === '' ||
Consider simplifying this complex logical expression. Open
if (
apiInfo.ServiceType !== 'SCF' ||
apiInfo.ServiceTimeout !== config.config.ServiceTimeout ||
apiInfo.ServiceScfFunctionName !== config.config.ServiceScfFunctionName ||
apiInfo.ServiceScfFunctionNamespace !==
Function action
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public async action<PathOrData extends FaasAction>(
action: PathOrData | string,
params?: FaasParams<PathOrData>,
options?: Options
): Promise<Response<FaasData<PathOrData>>> {
- 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
Avoid too many return
statements within this function. Open
return null
Avoid too many return
statements within this function. Open
return Promise.reject(
new ResponseError({
message: res,
status: response.status,
headers,
Function constructor
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
constructor(label?: string) {
if (label) this.label = label
// When run with Jest and --silent, logger won't output anything
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"