autowp/autowp-frontend

View on GitHub
src/app/jcrop/jquery.Jcrop.js

Summary

Maintainability
F
2 wks
Test Coverage

Showing 24 of 24 total issues

Function Jcrop has a Cognitive Complexity of 267 (exceeds 5 allowed). Consider refactoring.
Open

function Jcrop(obj, opt) {
 
let $img;
let xscale;
let yscale;
Severity: Minor
Found in src/app/jcrop/jquery.Jcrop.js - About 5 days to fix

Function Jcrop has 889 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function Jcrop(obj, opt) {
 
let $img;
let xscale;
let yscale;
Severity: Major
Found in src/app/jcrop/jquery.Jcrop.js - About 4 days to fix

    File jquery.Jcrop.js has 913 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
    * jquery.Jcrop.js v0.9.12
    * jQuery Image Cropping Plugin - released under MIT License
    * Author: Kelly Hallman <khallman@gmail.com>
    * http://github.com/tapmodo/Jcrop
    Severity: Major
    Found in src/app/jcrop/jquery.Jcrop.js - About 2 days to fix

      Function Coords has 226 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const Coords = (function() {
      let x1 = 0,
      y1 = 0,
      x2 = 0,
      y2 = 0;
      Severity: Major
      Found in src/app/jcrop/jquery.Jcrop.js - About 1 day to fix

        Function Selection has 177 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const Selection = (function() {
        let awake,
        hdep = 370,
        borders = {},
        handle = {},
        Severity: Major
        Found in src/app/jcrop/jquery.Jcrop.js - About 7 hrs to fix

          Function getFixed has 84 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function getFixed() {
          if (!options.aspectRatio) {
          return getRect();
          }
          // This function could use some optimization I think...
          Severity: Major
          Found in src/app/jcrop/jquery.Jcrop.js - About 3 hrs to fix

            Function Tracker has 64 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const Tracker = (function() {
            let onMove = function () {
            },
            onDone = function () {
            };
            Severity: Major
            Found in src/app/jcrop/jquery.Jcrop.js - About 2 hrs to fix

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

              function getRect() {
              let xsize = x2 - x1,
              ysize = y2 - y1,
              delta;
               
               
              Severity: Major
              Found in src/app/jcrop/jquery.Jcrop.js - About 2 hrs to fix

                Function dragmodeHandler has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function dragmodeHandler(mode, f) {
                return function(pos) {
                if (!options.aspectRatio) {
                switch (mode) {
                case 'e':
                Severity: Minor
                Found in src/app/jcrop/jquery.Jcrop.js - About 1 hr to fix

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

                  function interfaceUpdate(
                  alt // This method tweaks the interface based on options object. // Called when options are changed and at end of initialization.
                  ) {
                  if (alt) {
                  Selection.enableOnly();
                  Severity: Minor
                  Found in src/app/jcrop/jquery.Jcrop.js - About 1 hr to fix

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

                    if (xx > x1) {
                    // right side
                    if (xx - x1 < min_x) {
                    xx = x1 + min_x;
                    } else if (xx - x1 > max_x) {
                    Severity: Major
                    Found in src/app/jcrop/jquery.Jcrop.js and 1 other location - About 3 hrs to fix
                    src/app/jcrop/jquery.Jcrop.js on lines 663..675

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

                    } else if (xx < x1) {
                    // left side
                    if (x1 - xx < min_x) {
                    xx = x1 - min_x;
                    } else if (x1 - xx > max_x) {
                    Severity: Major
                    Found in src/app/jcrop/jquery.Jcrop.js and 1 other location - About 3 hrs to fix
                    src/app/jcrop/jquery.Jcrop.js on lines 651..675

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

                    if (xmin / xscale && Math.abs(xsize) < xmin / xscale) {
                    x2 = xsize > 0 ? x1 + xmin / xscale : x1 - xmin / xscale;
                    }
                    Severity: Major
                    Found in src/app/jcrop/jquery.Jcrop.js and 1 other location - About 1 hr to fix
                    src/app/jcrop/jquery.Jcrop.js on lines 734..736

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

                    if (ymin / yscale && Math.abs(ysize) < ymin / yscale) {
                    y2 = ysize > 0 ? y1 + ymin / yscale : y1 - ymin / yscale;
                    }
                    Severity: Major
                    Found in src/app/jcrop/jquery.Jcrop.js and 1 other location - About 1 hr to fix
                    src/app/jcrop/jquery.Jcrop.js on lines 737..739

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

                    if (xx < 0) {
                    xx = 0;
                    h = Math.abs((xx - x1) / aspect);
                    yy = rh < 0 ? y1 - h : h + y1;
                    } else if (xx > boundx) {
                    Severity: Major
                    Found in src/app/jcrop/jquery.Jcrop.js and 1 other location - About 1 hr to fix
                    src/app/jcrop/jquery.Jcrop.js on lines 639..647

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

                    function createHandles(li) {
                    for (let i = 0; i < li.length; i++) {
                    handle[li[i]] = insertHandle(li[i]);
                    }
                    }
                    Severity: Major
                    Found in src/app/jcrop/jquery.Jcrop.js and 1 other location - About 1 hr to fix
                    src/app/jcrop/jquery.Jcrop.js on lines 271..275

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

                    function createDragbars(li) {
                    for (let i = 0; i < li.length; i++) {
                    dragbar[li[i]] = insertDragbar(li[i]);
                    }
                    }
                    Severity: Major
                    Found in src/app/jcrop/jquery.Jcrop.js and 1 other location - About 1 hr to fix
                    src/app/jcrop/jquery.Jcrop.js on lines 298..302

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

                    if (yy < 0) {
                    yy = 0;
                    w = Math.abs((yy - y1) * aspect);
                    xx = rw < 0 ? x1 - w : w + x1;
                    } else if (yy > boundy) {
                    Severity: Major
                    Found in src/app/jcrop/jquery.Jcrop.js and 1 other location - About 1 hr to fix
                    src/app/jcrop/jquery.Jcrop.js on lines 626..634

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

                    if (nw > w && w > 0) {
                    nw = w;
                    nh = (w / $obj.width()) * $obj.height();
                    }
                    Severity: Major
                    Found in src/app/jcrop/jquery.Jcrop.js and 1 other location - About 1 hr to fix
                    src/app/jcrop/jquery.Jcrop.js on lines 943..946

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

                    if (nh > h && h > 0) {
                    nh = h;
                    nw = (h / $obj.height()) * $obj.width();
                    }
                    Severity: Major
                    Found in src/app/jcrop/jquery.Jcrop.js and 1 other location - About 1 hr to fix
                    src/app/jcrop/jquery.Jcrop.js on lines 939..942

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

                    if (xx < 0) {
                    x1 -= xx;
                    xx = 0;
                    } else if (xx > boundx) {
                    x1 -= xx - boundx;
                    Severity: Major
                    Found in src/app/jcrop/jquery.Jcrop.js and 1 other location - About 1 hr to fix
                    src/app/jcrop/jquery.Jcrop.js on lines 685..691

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

                    if (yy < 0) {
                    y1 -= yy;
                    yy = 0;
                    } else if (yy > boundy) {
                    y1 -= yy - boundy;
                    Severity: Major
                    Found in src/app/jcrop/jquery.Jcrop.js and 1 other location - About 1 hr to fix
                    src/app/jcrop/jquery.Jcrop.js on lines 677..683

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

                    if (ylimit && Math.abs(ysize) > ylimit) {
                    y2 = ysize > 0 ? y1 + ylimit : y1 - ylimit;
                    }
                    Severity: Minor
                    Found in src/app/jcrop/jquery.Jcrop.js and 1 other location - About 40 mins to fix
                    src/app/jcrop/jquery.Jcrop.js on lines 727..729

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

                    if (xlimit && Math.abs(xsize) > xlimit) {
                    x2 = xsize > 0 ? x1 + xlimit : x1 - xlimit;
                    }
                    Severity: Minor
                    Found in src/app/jcrop/jquery.Jcrop.js and 1 other location - About 40 mins to fix
                    src/app/jcrop/jquery.Jcrop.js on lines 730..732

                    There are no issues that match your filters.

                    Category
                    Status