modxcms/revolution

View on GitHub
manager/assets/fileapi/FileAPI.js

Summary

Maintainability
F
2 wks
Test Coverage

File FileAPI.js has 3146 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*! FileAPI 2.0.19 - BSD | git://github.com/mailru/FileAPI.git
 * FileAPI — a set of  javascript tools for working with files. Multiupload, drag'n'drop and chunked file upload. Images: crop, resize and auto orientation by EXIF.
 */

/*
Severity: Major
Found in manager/assets/fileapi/FileAPI.js - About 1 wk to fix

    Function patch has 229 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                    patch: function (){
                        api.flashEngine = true;
    
                        // FileAPI
                        _inherit(api, {
    Severity: Major
    Found in manager/assets/fileapi/FileAPI.js - About 1 day to fix

      Function _send has 218 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              _send: function (options, data){
                  var _this = this, xhr, uid = _this.uid, onLoadFnName = _this.uid + "Load", url = options.url;
      
                  api.log('XHR._send:', data);
      
      
      Severity: Major
      Found in manager/assets/fileapi/FileAPI.js - About 1 day to fix

        Function upload has 142 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    upload: function (options){
                        options = _extend({
                              jsonp: 'callback'
                            , prepare: api.F
                            , beforeupload: api.F
        Severity: Major
        Found in manager/assets/fileapi/FileAPI.js - About 5 hrs to fix

          Function _apply has 82 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  _apply: function (image, fn){
                      var
                            canvas = getCanvas()
                          , m = this.getMatrix(image)
                          , ctx = canvas.getContext('2d')
          Severity: Major
          Found in manager/assets/fileapi/FileAPI.js - About 3 hrs to fix

            Function getDropFiles has 80 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                        getDropFiles: function (evt, callback){
                            var
                                  files = []
                                , all = []
                                , items
            Severity: Major
            Found in manager/assets/fileapi/FileAPI.js - About 3 hrs to fix

              Function renderImageToCanvas has 77 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  loadImage.renderImageToCanvas = function (
                      canvas,
                      img,
                      sourceX,
                      sourceY,
              Severity: Major
              Found in manager/assets/fileapi/FileAPI.js - About 3 hrs to fix

                Function _send has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                                        _send: function (options, formData){
                                            if(
                                                   formData.nodeName
                                                || formData.append && api.support.html5
                                                || api.isArray(formData) && (typeof formData[0] === 'string')
                Severity: Major
                Found in manager/assets/fileapi/FileAPI.js - About 2 hrs to fix

                  Function _getFormData has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                              _getFormData: function (options, data, fn){
                                  var
                                        file = data.file
                                      , name = data.name
                                      , filename = file.name
                  Severity: Major
                  Found in manager/assets/fileapi/FileAPI.js - About 2 hrs to fix

                    Function transform has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        Image.transform = function (file, transform, autoOrientation, fn){
                            function _transform(err, img){
                                // img -- info object
                                var
                                      images = {}
                    Severity: Major
                    Found in manager/assets/fileapi/FileAPI.js - About 2 hrs to fix

                      Function _readEntryAsFiles has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function _readEntryAsFiles(entry, callback){
                              if( !entry ){
                                  // error
                                  var err = new Error('invalid entry');
                                  entry = new Object(entry);
                      Severity: Major
                      Found in manager/assets/fileapi/FileAPI.js - About 2 hrs to fix

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

                                        patchCamera: function () {
                                            api.Camera.fallback = function (el, options, callback) {
                                                var camId = api.uid();
                                                api.log('FlashAPI.Camera.publish: ' + camId);
                                                flash.publish(el, camId, api.extend(options, {
                        Severity: Major
                        Found in manager/assets/fileapi/FileAPI.js - About 2 hrs to fix

                          Function _transform has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  function _transform(err, img){
                                      // img -- info object
                                      var
                                            images = {}
                                          , queue = api.queue(function (err){
                          Severity: Major
                          Found in manager/assets/fileapi/FileAPI.js - About 2 hrs to fix

                            Function getMatrix has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    getMatrix: function (image){
                                        var
                                              m  = api.extend({}, this.matrix)
                                            , sw = m.sw = m.sw || image.videoWidth || image.naturalWidth ||  image.width
                                            , sh = m.sh = m.sh || image.videoHeight || image.naturalHeight || image.height
                            Severity: Major
                            Found in manager/assets/fileapi/FileAPI.js - About 2 hrs to fix

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

                                              (function _addFile(file/**Object*/){
                                                  if( file.image ){ // This is a FileAPI.Image
                                                      queue.inc();
                              
                                                      file.toData(function (err, image){
                              Severity: Minor
                              Found in manager/assets/fileapi/FileAPI.js - About 1 hr to fix

                                Function onreadystatechange has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                                    xhr.onreadystatechange = function (){
                                                        var lkb = parseInt(xhr.getResponseHeader('X-Last-Known-Byte'), 10);
                                
                                                        _this.status     = xhr.status;
                                                        _this.statusText = xhr.statusText;
                                Severity: Minor
                                Found in manager/assets/fileapi/FileAPI.js - About 1 hr to fix

                                  Function readAsImage has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                              readAsImage: function (file, fn, progress){
                                                  if( api.isBlob(file) ){
                                                      if( apiURL ){
                                                          /** @namespace apiURL.createObjectURL */
                                                          var data = apiURL.createObjectURL(file);
                                  Severity: Minor
                                  Found in manager/assets/fileapi/FileAPI.js - About 1 hr to fix

                                    Function getFiles has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                                getFiles: function (input, filter, callback){
                                                    var files = [];
                                    
                                                    if( callback ){
                                                        api.filterFiles(api.getFiles(input), filter, callback);
                                    Severity: Minor
                                    Found in manager/assets/fileapi/FileAPI.js - About 1 hr to fix

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

                                          api.event.dnd = function (el, onHover, onDrop){
                                              var _id, _type;
                                      
                                              if( !onDrop ){
                                                  onDrop = onHover;
                                      Severity: Minor
                                      Found in manager/assets/fileapi/FileAPI.js - About 1 hr to fix

                                        Function publish has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            Camera.publish = function (el, options, callback){
                                                if( typeof options == 'function' ){
                                                    callback = options;
                                                    options = {};
                                                }
                                        Severity: Minor
                                        Found in manager/assets/fileapi/FileAPI.js - About 1 hr to fix

                                          Function _apply has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                          Open

                                                                  _apply: function (file, fn){
                                                                      api.log('FlashAPI.Image._apply:', file);
                                          
                                                                      if( _isHtmlFile(file) ){
                                                                          this.parent.apply(this, arguments);
                                          Severity: Minor
                                          Found in manager/assets/fileapi/FileAPI.js - About 1 hr to fix

                                            Function mouseover has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                                            mouseover: function (evt){
                                                                var target = api.event.fix(evt).target;
                                            
                                                                if( /input/i.test(target.nodeName) && target.type == 'file' && !target.disabled ){
                                                                    var
                                            Severity: Minor
                                            Found in manager/assets/fileapi/FileAPI.js - About 1 hr to fix

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

                                                      function _makeFlashImage(opts, base64, fn){
                                                          var
                                                                key
                                                              , flashId = api.uid()
                                                              , el = document.createElement('div')
                                              Severity: Minor
                                              Found in manager/assets/fileapi/FileAPI.js - About 1 hr to fix

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

                                                            load: function (url, fn){
                                                                var xhr = api.getXHR();
                                                                if( xhr ){
                                                                    xhr.open('GET', url, true);
                                                
                                                
                                                Severity: Minor
                                                Found in manager/assets/fileapi/FileAPI.js - About 1 hr to fix

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

                                                      function _convertFile(file, fn, useBinaryString){
                                                          var blob = file.blob, filename = file.file;
                                                  
                                                          if( filename ){
                                                              if( !blob.toDataURL ){
                                                  Severity: Minor
                                                  Found in manager/assets/fileapi/FileAPI.js - About 1 hr to fix

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

                                                                _getFilesDataArray: function (data){
                                                                    var files = [], oFiles = {};
                                                    
                                                                    if( isInputFile(data) ){
                                                                        var tmp = api.getFiles(data);
                                                    Severity: Minor
                                                    Found in manager/assets/fileapi/FileAPI.js - About 1 hr to fix

                                                      Function renderImageToCanvas has 10 arguments (exceeds 4 allowed). Consider refactoring.
                                                      Open

                                                              canvas,
                                                              img,
                                                              sourceX,
                                                              sourceY,
                                                              sourceWidth,
                                                      Severity: Major
                                                      Found in manager/assets/fileapi/FileAPI.js - About 1 hr to fix

                                                        Function renderImageToCanvas has 10 arguments (exceeds 4 allowed). Consider refactoring.
                                                        Open

                                                            api.renderImageToCanvas = function (canvas, img, sx, sy, sw, sh, dx, dy, dw, dh){
                                                        Severity: Major
                                                        Found in manager/assets/fileapi/FileAPI.js - About 1 hr to fix

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

                                                                      queue: function (fn){
                                                                          var
                                                                                _idx = 0
                                                                              , _length = 0
                                                                              , _fail = false
                                                          Severity: Minor
                                                          Found in manager/assets/fileapi/FileAPI.js - About 1 hr to fix

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

                                                                function _readAs(file, fn, method, encoding){
                                                                    if( api.isBlob(file) && _hasSupportReadAs(method) ){
                                                                        var Reader = new FileReader;
                                                            
                                                                        // Add event listener
                                                            Severity: Minor
                                                            Found in manager/assets/fileapi/FileAPI.js - About 1 hr to fix

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

                                                                      toPlainData: function (fn){
                                                                          this._to({}, fn, function (file, data, queue){
                                                                              if( file.file ){
                                                                                  data.type = file.file;
                                                                              }
                                                              Severity: Minor
                                                              Found in manager/assets/fileapi/FileAPI.js - About 1 hr to fix

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

                                                                    loadImage.detectVerticalSquash = function (img, subsampled) {
                                                                        var naturalHeight = img.naturalHeight || img.height,
                                                                            canvas = document.createElement('canvas'),
                                                                            context = canvas.getContext('2d'),
                                                                            data,
                                                                Severity: Minor
                                                                Found in manager/assets/fileapi/FileAPI.js - About 1 hr to fix

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

                                                                              getInfo: function (file, fn){
                                                                                  var info = {}, readers = _infoReader.concat();
                                                                  
                                                                                  if( api.isBlob(file) ){
                                                                                      (function _next(){
                                                                  Severity: Minor
                                                                  Found in manager/assets/fileapi/FileAPI.js - About 1 hr to fix

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

                                                                        function _isRegularFile(file, callback){
                                                                            // http://stackoverflow.com/questions/8856628/detecting-folders-directories-in-javascript-filelist-objects
                                                                            if( !file.type && (safari || ((file.size % 4096) === 0 && (file.size <= 102400))) ){
                                                                                if( FileReader ){
                                                                                    try {
                                                                    Severity: Minor
                                                                    Found in manager/assets/fileapi/FileAPI.js - About 1 hr to fix

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

                                                                                                          , callback: _wrap(function _(err, base64){
                                                                                                              api.log('FlashAPI.Image._apply.callback:', err);
                                                                                                              _unwrap(_);
                                                                      
                                                                                                              if( err ){
                                                                      Severity: Minor
                                                                      Found in manager/assets/fileapi/FileAPI.js - About 1 hr to fix

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

                                                                                    window.ArrayBuffer && window.Uint8Array && function (dataURI) {
                                                                                        var byteString,
                                                                                            arrayBuffer,
                                                                                            intArray,
                                                                                            i,
                                                                        Severity: Minor
                                                                        Found in manager/assets/fileapi/FileAPI.js - About 1 hr to fix

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

                                                                                                      var queue = api.queue(function (){
                                                                                                          flash.cmd(flashId, 'upload', {
                                                                                                                url: _getUrl(options.url.replace(/([a-z]+)=(\?)&?/i, ''))
                                                                                                              , data: data
                                                                                                              , files: fileId ? files : null
                                                                          Severity: Minor
                                                                          Found in manager/assets/fileapi/FileAPI.js - About 1 hr to fix

                                                                            Avoid deeply nested control flow statements.
                                                                            Open

                                                                                                        if( _type != 'dragleave' ){
                                                                                                            onHover.call(evt[currentTarget], true, evt);
                                                                                                        }
                                                                            Severity: Major
                                                                            Found in manager/assets/fileapi/FileAPI.js - About 45 mins to fix

                                                                              Avoid deeply nested control flow statements.
                                                                              Open

                                                                                                              if( entry.isDirectory || (entry.isFile && file.name == file.name.normalize('NFC')) ){
                                                                                                                  items[i] = entry;
                                                                                                              }
                                                                                                              else {
                                                                                                                  items[i] = file;
                                                                              Severity: Major
                                                                              Found in manager/assets/fileapi/FileAPI.js - About 45 mins to fix

                                                                                Avoid deeply nested control flow statements.
                                                                                Open

                                                                                                                        if( !dataURLtoBlob && !api.flashEngine ){
                                                                                                                            Form.multipart = true;
                                                                                                                        }
                                                                                Severity: Major
                                                                                Found in manager/assets/fileapi/FileAPI.js - About 45 mins to fix

                                                                                  Avoid deeply nested control flow statements.
                                                                                  Open

                                                                                                                  if (((!xhr.status && !xhr.aborted) || 500 == xhr.status || 416 == xhr.status) && ++data.retry <= options.chunkUploadRetry) {
                                                                                                                      // let's try again the same chunk
                                                                                                                      // only applicable for recoverable error codes 500 && 416
                                                                                                                      var delay = xhr.status ? 0 : api.chunkNetworkDownRetryTimeout;
                                                                                  
                                                                                  
                                                                                  Severity: Major
                                                                                  Found in manager/assets/fileapi/FileAPI.js - About 45 mins to fix

                                                                                    Avoid deeply nested control flow statements.
                                                                                    Open

                                                                                                                            if( !trans[idx].postName ){
                                                                                                                                addOrigin = 1;
                                                                                                                            }
                                                                                    Severity: Major
                                                                                    Found in manager/assets/fileapi/FileAPI.js - About 45 mins to fix

                                                                                      Avoid deeply nested control flow statements.
                                                                                      Open

                                                                                                                      if (data.end == data.size - 1) {
                                                                                                                          // finished
                                                                                                                          _this.end(xhr.status);
                                                                                                                      } else {
                                                                                                                          // next chunk
                                                                                      Severity: Major
                                                                                      Found in manager/assets/fileapi/FileAPI.js - About 45 mins to fix

                                                                                        Avoid deeply nested control flow statements.
                                                                                        Open

                                                                                                                        if (((!xhr.status && !xhr.aborted) || 500 == xhr.status) && (options.retry || 0) < options.uploadRetry) {
                                                                                                                            options.retry = (options.retry || 0) + 1;
                                                                                                                            var delay = api.networkDownRetryTimeout;
                                                                                        
                                                                                                                            // inform about recoverable problems
                                                                                        Severity: Major
                                                                                        Found in manager/assets/fileapi/FileAPI.js - About 45 mins to fix

                                                                                          Consider simplifying this complex logical expression.
                                                                                          Open

                                                                                                              if( ( proxyXHR.statusText != 'abort' || proxyXHR.current ) && data ){
                                                                                                                  // Mark active job
                                                                                                                  _complete = false;
                                                                                          
                                                                                                                  // Set current upload file
                                                                                          Severity: Major
                                                                                          Found in manager/assets/fileapi/FileAPI.js - About 40 mins to fix

                                                                                            Consider simplifying this complex logical expression.
                                                                                            Open

                                                                                                    if( navigator.plugins && typeof navigator.plugins['Shockwave Flash'] == 'object' ){
                                                                                                        has    = navigator.plugins['Shockwave Flash'].description && !(mime && mime['application/x-shockwave-flash'] && !mime['application/x-shockwave-flash'].enabledPlugin);
                                                                                                    }
                                                                                                    else {
                                                                                                        try {
                                                                                            Severity: Major
                                                                                            Found in manager/assets/fileapi/FileAPI.js - About 40 mins to fix

                                                                                              Consider simplifying this complex logical expression.
                                                                                              Open

                                                                                                                              if (((!xhr.status && !xhr.aborted) || 500 == xhr.status) && (options.retry || 0) < options.uploadRetry) {
                                                                                                                                  options.retry = (options.retry || 0) + 1;
                                                                                                                                  var delay = api.networkDownRetryTimeout;
                                                                                              
                                                                                                                                  // inform about recoverable problems
                                                                                              Severity: Major
                                                                                              Found in manager/assets/fileapi/FileAPI.js - About 40 mins to fix

                                                                                                Function _emit has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                Open

                                                                                                    function _emit(target, fn, name, res, ext){
                                                                                                Severity: Minor
                                                                                                Found in manager/assets/fileapi/FileAPI.js - About 35 mins to fix

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

                                                                                                                  else {
                                                                                                                      dw = round(sf >= df ? min(sw, dw) : dh*sf);
                                                                                                                      dh = round(sf >= df ? dw/sf : min(sh, dh));
                                                                                                                  }
                                                                                                  Severity: Major
                                                                                                  Found in manager/assets/fileapi/FileAPI.js and 1 other location - About 1 hr to fix
                                                                                                  manager/assets/fileapi/FileAPI.js on lines 2176..2179

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

                                                                                                  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

                                                                                                                  else if( strategy == 'min' ){
                                                                                                                      dw = round(sf < df ? min(sw, dw) : dh*sf);
                                                                                                                      dh = round(sf < df ? dw/sf : min(sh, dh));
                                                                                                                  }
                                                                                                  Severity: Major
                                                                                                  Found in manager/assets/fileapi/FileAPI.js and 1 other location - About 1 hr to fix
                                                                                                  manager/assets/fileapi/FileAPI.js on lines 2180..2183

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

                                                                                                  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

                                                                                                                    top:        box.top + (window.pageYOffset || docEl.scrollTop)  - (docEl.clientTop || body.clientTop || 0)
                                                                                                  Severity: Minor
                                                                                                  Found in manager/assets/fileapi/FileAPI.js and 1 other location - About 30 mins to fix
                                                                                                  manager/assets/fileapi/FileAPI.js on lines 4233..4233

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

                                                                                                  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

                                                                                                                  , left:        box.left + (window.pageXOffset || docEl.scrollLeft) - (docEl.clientLeft || body.clientLeft || 0)
                                                                                                  Severity: Minor
                                                                                                  Found in manager/assets/fileapi/FileAPI.js and 1 other location - About 30 mins to fix
                                                                                                  manager/assets/fileapi/FileAPI.js on lines 4232..4232

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

                                                                                                  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

                                                                                                  There are no issues that match your filters.

                                                                                                  Category
                                                                                                  Status