ngryman/ribs

View on GitHub

Showing 25 of 31 total issues

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

module.exports = function(root) {

    // root required
    if (!root) throw new Error('ribs.middleware() root path required');

Severity: Major
Found in lib/middleware.js - About 3 hrs to fix

    Function cropConstraintsHook has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    hooks.cropConstraintsHook = function(params, image) {
        var dstWidth = params.width,
            dstHeight = params.height,
            anchor = params.anchor,
            gravity = params.gravity,
    Severity: Minor
    Found in lib/hooks.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 use has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    Pipeline.prototype.use = function(name, params) {
        // bypass on error
        if (this.error) return this;
    
        try {
    Severity: Minor
    Found in lib/pipeline.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 exports has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function(grunt) {
        // load npm tasks
        require('load-grunt-tasks')(grunt);
        // load time grunt
        require('time-grunt')(grunt);
    Severity: Major
    Found in Gruntfile.js - About 2 hrs to fix

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

      function parseArguments() {
          var src = args._[0],
              dst = args._[1],
              operations;
      
      
      Severity: Major
      Found in lib/cli.js - About 2 hrs to fix

        Function parseOperations has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function parseOperations(req, next, callback) {
                var url = req.url,
                    operations = [],
                    current;
        
        
        Severity: Minor
        Found in lib/middleware.js - About 2 hrs to fix

          Function to has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function to(params, image, next) {
              // arguments type
              check('next', next, false, 'function');
          
              try {
          Severity: Minor
          Found in lib/operations/to.js - About 1 hr to fix

            Function computeFormula has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

            utils.computeFormula = function(formula, number) {
                var f = parseFloat(formula),
                    i, o, v, len;
            
                // early return for falsy values
            Severity: Minor
            Found in lib/utils.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 cropConstraintsHook has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            hooks.cropConstraintsHook = function(params, image) {
                var dstWidth = params.width,
                    dstHeight = params.height,
                    anchor = params.anchor,
                    gravity = params.gravity,
            Severity: Minor
            Found in lib/hooks.js - About 1 hr to fix

              Function use has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              Pipeline.prototype.use = function(name, params) {
                  // bypass on error
                  if (this.error) return this;
              
                  try {
              Severity: Minor
              Found in lib/pipeline.js - About 1 hr to fix

                Function crop has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function crop(params, image, next) {
                    var width, height;
                
                    // arguments type
                    check('next', next, false, 'function');
                Severity: Minor
                Found in lib/operations/crop.js - About 1 hr to fix

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

                  hooks.resizeConstraintsHook = function(params, image) {
                      var dstWidth = params.width,
                          dstHeight = params.height,
                          srcWidth = image.width,
                          srcHeight = image.height;
                  Severity: Minor
                  Found in lib/hooks.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 ribs has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                  var ribs = function(src, dst, bulk, callback) {
                      var pipeline = new Pipeline();
                  
                      /** `(bulk, callback)` */
                  
                  
                  Severity: Minor
                  Found in lib/ribs.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 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                  module.exports = function(root) {
                  
                      // root required
                      if (!root) throw new Error('ribs.middleware() root path required');
                  
                  
                  Severity: Minor
                  Found in lib/middleware.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 resizeConstraintsHook has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  hooks.resizeConstraintsHook = function(params, image) {
                      var dstWidth = params.width,
                          dstHeight = params.height,
                          srcWidth = image.width,
                          srcHeight = image.height;
                  Severity: Minor
                  Found in lib/hooks.js - About 1 hr to fix

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

                    function from(src, next) {
                        check('next', next, false, 'function');
                    
                        try {
                            check('params', src, false, 'string', 'object', 'array');
                    Severity: Minor
                    Found in lib/operations/from.js - About 1 hr to fix

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

                      function resize(params, image, next) {
                          // arguments type
                          check('next', next, false, 'function');
                      
                          try {
                      Severity: Minor
                      Found in lib/operations/resize.js - About 1 hr to fix

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

                        function crop(params, image, next) {
                            var width, height;
                        
                            // arguments type
                            check('next', next, false, 'function');
                        Severity: Minor
                        Found in lib/operations/crop.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 computeRegionOrigin has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        utils.computeRegionOrigin = function(anchor, width, height, x, y, coords) {
                        Severity: Minor
                        Found in lib/utils.js - About 45 mins to fix

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

                          function resize(params, image, next) {
                              // arguments type
                              check('next', next, false, 'function');
                          
                              try {
                          Severity: Minor
                          Found in lib/operations/resize.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