tunnckoCore/gibon

View on GitHub

Showing 108 of 164 total issues

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

function initServer() {
  const server = createServer(async (req, res) => {
    if (req.url === '/' && req.method.toLowerCase() === 'post') {
      // parse a file upload
      // `upload` does nothing now, could be used with `createTemporary*`
Severity: Minor
Found in modules/formidable-mini/example.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 testResults has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const testResults = await new Promise((resolve) => {
    proc
      .then(() => {
        resolve(
          pass({
Severity: Minor
Found in @packages/jest-runner-node/src/runner.js - About 1 hr to fix

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

    export default function parseFunction(opts = {}) {
      const plugins = [];
      const app = {
        /**
         * > Parse a given `code` and returns a `result` object
    Severity: Minor
    Found in @packages/parse-function/src/index.js - About 1 hr to fix

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

      function initServer() {
        const server = createServer(async (req, res) => {
          if (req.url === '/' && req.method.toLowerCase() === 'post') {
            // parse a file upload
            // `upload` does nothing now, could be used with `createTemporary*`
      Severity: Minor
      Found in modules/formidable-mini/example.js - About 1 hr to fix

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

              async function commandAction(parsedFlags, ...argz) {
                const argv = pipeline(
                  // run parser only if when we are given process.argv array
                  Array.isArray(parsedFlags) && parser(),
                  aliases(cli.meta.aliases), // aliases always first
        Severity: Minor
        Found in yaro/yaro-command/src/core.js - About 1 hr to fix

          Function findMatchCommand has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function findMatchCommand(entries, meta) {
            const match = entries.find(([name, cmd]) => {
              if (cmd.isYaroCommand) {
                let matched = false;
          
          
          Severity: Minor
          Found in yaro/yaro-create-cli/src/index.js - About 1 hr to fix

            Function jestCov has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                .reduce((acc, file) => {
                  let value = files[file];
            
                  const [monoDir, ws, folderName] = file.split('/');
            
            
            Severity: Minor
            Found in @tunnckocore/utils/src/index.js - About 1 hr to fix

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

              module.exports = utils.errorBase('UsefulError', function (message, options) {
                if (typeof message === 'object') {
                  options = message;
                  message = false;
                }
              Severity: Minor
              Found in modules/formidable-mini/fixture.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 packageJson has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              export default async function packageJson(packageName, endpoint) {
                const { name, version } = parsePkgName(packageName);
                const tag = version === '' ? 'latest' : version;
                const uri =
                  typeof endpoint === 'function'
              Severity: Minor
              Found in @tunnckocore/package-json/src/index.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 stringToHeader has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function stringToHeader(val, options) {
                const opts = { caseSensitive: false, ...options };
              
                /* eslint-disable unicorn/no-unsafe-regex */
                const defaultRegex = opts.caseSensitive
              Severity: Minor
              Found in @packages/parse-commit-message/src/utils.js - About 1 hr to fix

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

                async function tryCatch(code, meta, fn) {
                  let result = null;
                  try {
                    result = await fn(meta.argv);
                  } catch (err) {
                Severity: Minor
                Found in yaro/yaro-create-cli/src/index.js - About 1 hr to fix

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

                  export async function each(items, mapper, options = {}) {
                    if (typeof mapper !== 'function') {
                      options = mapper;
                      mapper = (x) => x;
                    }
                  Severity: Minor
                  Found in @tunnckocore/p-all/src/index.js - About 1 hr to fix

                    Function exports has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    module.exports = utils.errorBase('UsefulError', function (message, options) {
                      if (typeof message === 'object') {
                        options = message;
                        message = false;
                      }
                    Severity: Minor
                    Found in modules/formidable-mini/fixture.js - About 1 hr to fix

                      Consider simplifying this complex logical expression.
                      Open

                        if (err && has && !err.cmdUsage) {
                          const isRootFailed = /ROOT_COMMAND_FAILED/.test(err.code);
                          const cmdErr = err.meta.matchedCommand?.cli || meta.cliInfo;
                      
                          cmdErr.usage = cmdErr.usage.trim();
                      Severity: Major
                      Found in yaro/yaro-create-cli/src/utils.js - About 1 hr to fix

                        Function stringToHeader has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export function stringToHeader(val, options) {
                          const opts = { caseSensitive: false, ...options };
                        
                          /* eslint-disable unicorn/no-unsafe-regex */
                          const defaultRegex = opts.caseSensitive
                        Severity: Minor
                        Found in @packages/parse-commit-message/src/utils.js - About 55 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 parseFunction has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export default function parseFunction(opts = {}) {
                          const plugins = [];
                          const app = {
                            /**
                             * > Parse a given `code` and returns a `result` object
                        Severity: Minor
                        Found in @packages/parse-function/src/index.js - About 55 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 stringifyGithubShortUrl has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export default function stringifyGithubShortUrl(owner, name, branch, npm) {
                          if (owner && typeof owner === 'object') {
                            const params = owner;
                            owner = params.owner || params.user;
                            name = params.name || params.repo;
                        Severity: Minor
                        Found in @packages/stringify-github-short-url/src/index.js - About 55 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 tryCatch has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                        async function tryCatch(code, meta, fn) {
                          let result = null;
                          try {
                            result = await fn(meta.argv);
                          } catch (err) {
                        Severity: Minor
                        Found in yaro/yaro-create-cli/src/index.js - About 55 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 testCoverage has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function testCoverage(rootDir, testCovPath) {
                          const {
                            packageJsonPath,
                            packageJson: pkg,
                            isMonorepo: isMono,
                        Severity: Minor
                        Found in @tunnckocore/utils/src/index.js - About 55 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 ipFilter has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export default function ipFilter(ip, patterns, options) {
                          if (typeof ip !== 'string') {
                            throw new TypeError('ip-filter: expect `ip` to be a string');
                          }
                        
                        
                        Severity: Minor
                        Found in modules/ip-filter/src/index.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

                        Severity
                        Category
                        Status
                        Source
                        Language