Showing 8 of 12 total issues
Function exports
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (options) => {
options = deepmerge({
html: {
pattern: '**/*.html',
tags: {
Function test
has 53 lines of code (exceeds 25 allowed). Consider refactoring. 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 validUrl
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
const validUrl = (link, options, callback, attempt = 1, method = 'HEAD') => {
const cacheAndCallback = (err, result) => {
// Retry failures if we haven't reached the retry limit
if (result && attempt <= options.attempts) {
setTimeout(() => {
Function validFacetime
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const validFacetime = (link) => {
// https://developer.apple.com/library/archive/featuredarticles/iPhoneURLScheme_Reference/FacetimeLinks/FacetimeLinks.html
if (link === 'facetime:') {
return null;
}
- 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 test
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. 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"
Further reading
Avoid too many return
statements within this function. Open
return 'invalid phone number';
Avoid too many return
statements within this function. Open
return null;
Function validUrl
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const validUrl = (link, options, callback, attempt = 1, method = 'HEAD') => {
const cacheAndCallback = (err, result) => {
// Retry failures if we haven't reached the retry limit
if (result && attempt <= options.attempts) {
setTimeout(() => {
- 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"