owncloud/core

View on GitHub
core/js/oc-backbone-webdav.js

Summary

Maintainability
C
1 day
Test Coverage

File oc-backbone-webdav.js has 344 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright (c) 2015
 *
 * This file is licensed under the Affero General Public License version 3
 * or later.
Severity: Minor
Found in core/js/oc-backbone-webdav.js - About 4 hrs to fix

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

        function davSync(method, model, options) {
            var params = {type: getTypeForMethod(method, model)};
            var isCollection = (model instanceof Backbone.Collection);
    
            // Ensure that we have a URL.
    Severity: Minor
    Found in core/js/oc-backbone-webdav.js - About 1 hr to fix

      Function callMethod has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function callMethod(client, options, model, headers) {
              var data = options.data;
              if (_.isObject(data)) {
                  headers['Content-Type'] = 'application/json';
                  data = JSON.stringify(data);
      Severity: Minor
      Found in core/js/oc-backbone-webdav.js - About 1 hr to fix

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

            function callPropPatch(client, options, model, headers) {
                var changes = model.changed;
                if (options.wait && _.isEmpty(changes)) {
                    // usually with "wait" mode, the changes aren't set yet,
                    changes = options.data;
        Severity: Minor
        Found in core/js/oc-backbone-webdav.js - About 1 hr to fix

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

              function getTypeForMethod(method, model) {
                  var type = methodMap[method];
          
                  if (!type) {
                      // return method directly
          Severity: Minor
          Found in core/js/oc-backbone-webdav.js - About 1 hr to fix

            Consider simplifying this complex logical expression.
            Open

                    if (options.data == null && model && (method === 'create' || method === 'update' || method === 'patch')) {
                        params.data = options.attrs || model.toJSON(options);
                    }
            Severity: Major
            Found in core/js/oc-backbone-webdav.js - About 40 mins to fix

              There are no issues that match your filters.

              Category
              Status