Showing 11 of 23 total issues
Function createOneMeta
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function createOneMeta (srcDir, subDir, fileName) {
const dir = path.join(srcDir, subDir);
const displayName = path.basename(fileName, '.html');
const fontFileName = `${displayName}Web.woff`;
Function buildFontData
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function buildFontData (fontFaceRule, dir) {
const fontFamily = css.getFontFamilyValue(fontFaceRule);
if (!fontFamily) {
throw new Error('Font-family must be set');
}
Function buildFontData
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function buildFontData (fontFaceRule, dir) {
const fontFamily = css.getFontFamilyValue(fontFaceRule);
if (!fontFamily) {
throw new Error('Font-family must be set');
}
Function buildFontData
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function buildFontData (fontFaceRule, dir) {
const fontFamily = css.getFontFamilyValue(fontFaceRule);
if (!fontFamily) {
throw new Error('Font-family must be set');
}
Function buildFontData
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function buildFontData (fontFaceRule, dir) {
const fontFamily = css.getFontFamilyValue(fontFaceRule);
if (!fontFamily) {
throw new Error('Font-family must be set');
}
Function buildFontData
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function buildFontData (fontFaceRule, dir) {
const fontFamily = css.getFontFamilyValue(fontFaceRule);
if (!fontFamily) {
throw new Error('Font-family must be set');
}
Function exports
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
module.exports = async (dir) => {
if (await isFontsComMulti(dir)) {
return createFontsComMultiMeta(dir);
}
- 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
Open
return createMyFontsMeta(dir);
Avoid too many return
statements within this function. Open
Open
return createTransfonterMeta(dir);
Avoid too many return
statements within this function. Open
Open
return createLinotypeMeta(dir);
Function isFontShop
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
module.exports.isFontShop = (dir) => new Promise(async (resolve, reject) => {
try {
// it should only one sub dir
const [subDirName] = await misc.findSubDirs(dir);
if (!subDirName) {
- 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"