danielrohers/bory

View on GitHub

Showing 12 of 12 total issues

Function json has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

function json(options) {
  const opts = options || {};

  const limit = getLimit(opts);
  const inflate = opts.inflate !== false;
Severity: Minor
Found in lib/types/json.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

Function read has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function read(req, res, next, parse, debug, options) {
  let length;
  const opts = options || {};
  let stream;

Severity: Major
Found in lib/read.js - About 2 hrs to fix

    Function json has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function json(options) {
      const opts = options || {};
    
      const limit = getLimit(opts);
      const inflate = opts.inflate !== false;
    Severity: Major
    Found in lib/types/json.js - About 2 hrs to fix

      Function urlencoded has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function urlencoded(options) {
        const opts = options || {};
      
        // notice because option default will flip in next major
        if (opts.extended === undefined) {
      Severity: Minor
      Found in lib/types/urlencoded.js - About 1 hr to fix

        Function text has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function text(options) {
          const opts = options || {};
          const defaultCharset = opts.defaultCharset || 'utf-8';
          const inflate = opts.inflate !== false;
          const limit = getLimit(opts);
        Severity: Minor
        Found in lib/types/text.js - About 1 hr to fix

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

          function raw(options) {
            const opts = options || {};
            const inflate = opts.inflate !== false;
            const limit = getLimit(opts);
            const type = opts.type || 'application/octet-stream';
          Severity: Minor
          Found in lib/types/raw.js - About 1 hr to fix

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

            function contentstream(req, debug, inflate) {
              const encoding = (req.headers['content-encoding'] || 'identity').toLowerCase();
              const length = req.headers['content-length'];
              let stream;
            
            
            Severity: Minor
            Found in lib/read.js - About 1 hr to fix

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

              function urlencoded(options) {
                const opts = options || {};
              
                // notice because option default will flip in next major
                if (opts.extended === undefined) {
              Severity: Minor
              Found in lib/types/urlencoded.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 merge has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              function merge(object, parsed) {
                if (!isObject(parsed)) {
                  object = parsed;
                  return object;
                }
              Severity: Minor
              Found in lib/types/nested.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 read has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              function read(req, res, next, parse, debug, options) {
              Severity: Minor
              Found in lib/read.js - About 45 mins to fix

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

                function read(req, res, next, parse, debug, options) {
                  let length;
                  const opts = options || {};
                  let stream;
                
                
                Severity: Minor
                Found in lib/read.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

                Function bory has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                function bory(options) {
                  const opts = {};
                
                  // exclude type option
                  if (options) {
                Severity: Minor
                Found in index.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