ginpei/rad-extract-webfont-kit

View on GitHub

Showing 11 of 23 total issues

Function createOneMeta has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

async function createOneMeta (srcDir, subDir, fileName) {
  const dir = path.join(srcDir, subDir);

  const displayName = path.basename(fileName, '.html');
  const fontFileName = `${displayName}Web.woff`;
Severity: Minor
Found in src/generateMeta/fontShop.js - About 1 hr to fix

    Function buildFontData has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    async function buildFontData (fontFaceRule, dir) {
      const fontFamily = css.getFontFamilyValue(fontFaceRule);
      if (!fontFamily) {
        throw new Error('Font-family must be set');
      }
    Severity: Minor
    Found in src/generateMeta/myFonts.js - About 1 hr to fix

      Function buildFontData has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      async function buildFontData (fontFaceRule, dir) {
        const fontFamily = css.getFontFamilyValue(fontFaceRule);
        if (!fontFamily) {
          throw new Error('Font-family must be set');
        }
      Severity: Minor
      Found in src/generateMeta/fontsCom.js - About 1 hr to fix

        Function buildFontData has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        async function buildFontData (fontFaceRule, dir) {
          const fontFamily = css.getFontFamilyValue(fontFaceRule);
          if (!fontFamily) {
            throw new Error('Font-family must be set');
          }
        Severity: Minor
        Found in src/generateMeta/linotype.js - About 1 hr to fix

          Function buildFontData has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          async function buildFontData (fontFaceRule, dir) {
            const fontFamily = css.getFontFamilyValue(fontFaceRule);
            if (!fontFamily) {
              throw new Error('Font-family must be set');
            }
          Severity: Minor
          Found in src/generateMeta/fontSquirrel.js - About 1 hr to fix

            Function buildFontData has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            async function buildFontData (fontFaceRule, dir) {
              const fontFamily = css.getFontFamilyValue(fontFaceRule);
              if (!fontFamily) {
                throw new Error('Font-family must be set');
              }
            Severity: Minor
            Found in src/generateMeta/transfonter.js - About 1 hr to fix

              Function exports has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              module.exports = async (dir) => {
                if (await isFontsComMulti(dir)) {
                  return createFontsComMultiMeta(dir);
                }
              
              
              Severity: Minor
              Found in src/generateMeta/index.js - About 35 mins to fix

              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 createMyFontsMeta(dir);
              Severity: Major
              Found in src/generateMeta/index.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return createTransfonterMeta(dir);
                Severity: Major
                Found in src/generateMeta/index.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return createLinotypeMeta(dir);
                  Severity: Major
                  Found in src/generateMeta/index.js - About 30 mins to fix

                    Function isFontShop has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    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) {
                    Severity: Minor
                    Found in src/generateMeta/fontShop.js - About 25 mins to fix

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language