jeffy-g/rm-cstyle-cmts

View on GitHub
scripts/tiny/tools.js

Summary

Maintainability
D
1 day
Test Coverage

Function fn has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

        fn() {
            const thisPackage = utils.readJson("./package.json");
            const recordPath = params.dest || "./logs/webpack-size.json";
            /** @type {Record<TVersionString, { webpack?: number; umd?: number}>} */
            const sizeRecord = fs.existsSync(recordPath)? utils.readJson(recordPath): {};
Severity: Minor
Found in scripts/tiny/tools.js - About 4 hrs 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 processSources has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

function processSources(
    taskName,
    process, {
        base = "./build", bases,
        test = /\.js$/,
Severity: Minor
Found in scripts/tiny/tools.js - About 2 hrs 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

File tools.js has 273 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env node
/*!
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  Copyright (C) 2019 jeffy-g <hirotom1107@gmail.com>
  Released under the MIT license
Severity: Minor
Found in scripts/tiny/tools.js - About 2 hrs to fix

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

            fn() {
                const thisPackage = utils.readJson("./package.json");
                const recordPath = params.dest || "./logs/webpack-size.json";
                /** @type {Record<TVersionString, { webpack?: number; umd?: number}>} */
                const sizeRecord = fs.existsSync(recordPath)? utils.readJson(recordPath): {};
    Severity: Major
    Found in scripts/tiny/tools.js - About 2 hrs to fix

      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

        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 fn has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                  fn: () => {
                      processSources(
                          "[comment trick toggle]", (data) => {
                              return data.replace(/\/+(?=\*\s?(comment-toggle-trick|https:\/\/coderwall))/g, $0 => {
                                  const slashes = $0.length === 2? "/": "//";
          Severity: Minor
          Found in scripts/tiny/tools.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

          There are no issues that match your filters.

          Category
          Status