tunnckoCore/gibon

View on GitHub

Showing 120 of 120 total issues

Function thunk has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  return function thunk(done) {
    const fields = {};
    const fileFields = {};
    const files = [];
    const form =
Severity: Minor
Found in @packages/koa-better-body/src/utils.js - About 1 hr to fix

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

    export default function allModulePaths(options = {}) {
      const { paths } = { paths: [], ...options };
    
      assert(Array.isArray(paths), 'expect options.paths to be string[]');
    
    
    Severity: Minor
    Found in @packages/all-module-paths/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 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 stringToHeader has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function stringToHeader(val: string, options?: Options): Header {
          if (typeof val !== 'string') {
            throw new TypeError('stringToHeader: expects `val` to be a string');
          }
        
        
        Severity: Minor
        Found in @packages/parse-commit-message/src/utils.ts - About 1 hr to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  async (err) => {
                    const res = { status: 'rejected', reason: err, index };
                    const ret = await opts.afterEach(res, index, items);
          
                    return { ...res, ...ret };
          Severity: Major
          Found in @tunnckocore/p-all/src/index.js and 1 other location - About 1 hr to fix
          @tunnckocore/p-all/src/index.js on lines 70..75

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 59.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  async (value) => {
                    const res = { status: 'fulfilled', value, index };
                    const ret = await opts.afterEach(res, index, items);
          
                    return { ...res, ...ret };
          Severity: Major
          Found in @tunnckocore/p-all/src/index.js and 1 other location - About 1 hr to fix
          @tunnckocore/p-all/src/index.js on lines 76..81

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 59.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

              export function stringToHeader(val: string, options?: Options): Header {
                if (typeof val !== 'string') {
                  throw new TypeError('stringToHeader: expects `val` to be a string');
                }
              
              
              Severity: Minor
              Found in @packages/parse-commit-message/src/utils.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 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 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 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

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                  const cfg = {
                    target: 'es2023',
                    entry: ['src/index.ts'],
                    splitting: false,
                    clean: true,
                  Severity: Major
                  Found in @packages/parse-commit-message/tsup.config.ts and 1 other location - About 1 hr to fix
                  @packages/recommended-bump/tsup.config.ts on lines 3..12

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 55.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                  const cfg = {
                    target: 'es2023',
                    entry: ['src/index.ts'],
                    splitting: false,
                    clean: true,
                  Severity: Major
                  Found in @packages/recommended-bump/tsup.config.ts and 1 other location - About 1 hr to fix
                  @packages/parse-commit-message/tsup.config.ts on lines 3..12

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 55.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  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 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

                  Severity
                  Category
                  Status
                  Source
                  Language