Showing 6 of 8 total issues
Function retryJsonGet
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
Open
const retryJsonGet = (link, options, callback, attempt = 1) => {
const url = new URL(link);
const library = {
'http:': http,
'https:': https,
- 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 retryJsonGet
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const retryJsonGet = (link, options, callback, attempt = 1) => {
const url = new URL(link);
const library = {
'http:': http,
'https:': https,
Function test
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const test = (dir, config) => {
describe(dir, () => {
// Allow src directory to not exist / be empty and not committed
if (!existsSync(`${dir}/src`)) {
mkdirSync(`${dir}/src`);
Function req
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const req = library.request(link, requestOptions, (res) => {
const rateLimitLimit = parseInt(res.headers['x-ratelimit-limit'], 10);
const rateLimitRemaining = parseInt(res.headers['x-ratelimit-remaining'], 10);
const rateLimitReset = parseInt(res.headers['x-ratelimit-reset'], 10);
Function exports
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = (options) => {
options = deepmerge({
timeout: 5 * 1000,
authorization: {},
retries: 3,
Function test
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
const test = (dir, config) => {
describe(dir, () => {
// Allow src directory to not exist / be empty and not committed
if (!existsSync(`${dir}/src`)) {
mkdirSync(`${dir}/src`);
- 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"