jeffy-g/rm-cstyle-cmts

View on GitHub

Showing 47 of 53 total issues

Function createWebpackProgressPluginHandler has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function createWebpackProgressPluginHandler(logFilePath, disableRenderLine = false) {

    const formatPercentage = (/** @type {number} */pct) => {
        return `processing ${(pct * 100).toFixed(4)}%`;
    };
Severity: Minor
Found in scripts/tiny/progress/index.js - About 1 hr to fix

    Function task has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

     async function task(
        grmc, settings, mode = "cjs"
    ) {
    
        const BASE_PREFIX = settings.useExtern ? "[If you want to scan external node_modules directory etc., set path here]" : ".";
    Severity: Minor
    Found in scripts/grmc-test-task.js - About 1 hr 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

    Function backQuote has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const backQuote: TCharScannerFunction = (src: string, ctx: TScannerContext): boolean | never => {
    
        // store "next" postion character. 
        let ch: TBD<string>;
        // cache start offset
    Severity: Minor
    Found in src/js-scanner.ts - About 1 hr to fix

      Function getExtraArgs has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function getExtraArgs(args_config, debug = false) {
          // debug log, if need.
          debug && console.log("process.argv: ", process.argv);
          /** @type {typeof ArgsConfig} */
          // @ts- ignore will be not `Partial`
      Severity: Minor
      Found in scripts/tiny/get-extra-args.js - About 1 hr to fix

        Function wppHandlerV5 has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        const wppHandlerV5 = ((renderer, cwd) => {
            return (percentage, message, ...args) => {
                if (!message) {
                    message = "- done -";
                }
        Severity: Minor
        Found in scripts/tiny/progress/progress-extras.js - About 1 hr 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

        Function emitMainFunction has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        const emitMainFunction = <
            T extends typeof apply | typeof walk,
            R extends ReturnType<T>
        >(fn: T): (...args: Parameters<T>) => R => {
        
        
        Severity: Minor
        Found in src/index.ts - About 1 hr 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

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

                fn: () => {
                    let {
                        major, minor/*, patch*/,
                        pkgJsons = ["./package.json"]
                    } = params;
        Severity: Minor
        Found in scripts/tiny/tools.js - About 1 hr to fix

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

              const transform: NsGulpRmc.FixTransformFunction = function (vinyl, encoding, callback) {
          
                  // plugin main
                  if (vinyl.isBuffer()) {
                      if (extensions.includes(vinyl.extname)) {
          Severity: Minor
          Found in src/gulp/index.ts - About 1 hr to fix

            Function createContext has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const createContext = (options: NsGulpRmc.TOptions) => {
            
                /** @type {TRemoveCStyleCommentsOpt} */
                const opt: TRemoveCStyleCommentsOpt = {
                    preserveBlanks: options.preserveBlanks,
            Severity: Minor
            Found in src/gulp/index.ts - About 1 hr to fix

              Function writeTextUTF8 has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function writeTextUTF8(content, dest, callback) {
                  // need dest parent dir check.
                  lib.checkParentDirectory(dest);
              
                  const ws = fs.createWriteStream(dest)
              Severity: Minor
              Found in scripts/tiny/utils.js - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                    if (settings.p === true) {
                        const stdin = process.stdin;
                        stdin.resume().setEncoding("utf8");
                        inputs = "";
                
                
                Severity: Major
                Found in src/bench/index.ts - About 1 hr to fix

                  Function writeTextUTF8 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function writeTextUTF8(content, dest, callback) {
                      // need dest parent dir check.
                      lib.checkParentDirectory(dest);
                  
                      const ws = fs.createWriteStream(dest)
                  Severity: Minor
                  Found in scripts/tiny/utils.js - About 45 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

                  Function quote has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const quote: TCharScannerFunction = (src: string, ctx: TScannerContext): boolean => {
                  
                      const startOffset = ctx.offset;
                      const q = src[startOffset];
                      // limiter
                  Severity: Minor
                  Found in src/js-scanner.ts - About 45 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 deeply nested control flow statements.
                  Open

                                      if (!ctx.isWalk) {
                                          ctx.result += src.substring(prevOffset, next);
                                      }
                  Severity: Major
                  Found in src/js-scanner.ts - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        if (!inspectable) {
                                            next++;
                                            continue;
                                        }
                    Severity: Major
                    Found in src/js-scanner.ts - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          if (scanListener!(eventContext)) {
                                              ctx.result += fragment;
                                          }
                      Severity: Major
                      Found in src/js-scanner.ts - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            if (code === EMetaChars.RIGHT_CURLY) {
                                                startOffset = ++next;
                                                /* https://coderwall
                                                when(prevOffset);
                                                /*/
                        Severity: Major
                        Found in src/js-scanner.ts - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                              if (value === void 0 || value.startsWith(actualConfig.prefix)) {
                                                  value = true;
                                              } else {
                                                  // DEVNOTE: now possible to process array parameters
                                                  // DEVNOTE: 2020/2/28 - support regex parameter
                          Severity: Major
                          Found in scripts/tiny/get-extra-args.js - About 45 mins to fix

                            Consider simplifying this complex logical expression.
                            Open

                                                if (
                                                    (prevEntry.webpack && entry.webpack) && (prevEntry.webpack ^ entry.webpack) ||
                                                    (prevEntry.umd && entry.umd) && (prevEntry.umd ^ entry.umd)
                                                ) {
                                                    sizeRecord[versionStr] = entry;
                            Severity: Major
                            Found in scripts/tiny/tools.js - About 40 mins to fix

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

                              export const lookupRegexes = (nl: TDetectedNewLines) => {
                                  return {
                                      /**
                                       * regex: whitespaces, quoted string, regexp literal
                                       * 
                              Severity: Minor
                              Found in src/reutil.ts - 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

                              Severity
                              Category
                              Status
                              Source
                              Language