r2js/r2admin

View on GitHub

Showing 45 of 1,887 total issues

File switchery.js has 919 lines of code (exceeds 250 allowed). Consider refactoring.
Open


;(function(){

/**
 * Require the module at `name`.
Severity: Major
Found in assets/lib/switchery/dist/switchery.js - About 2 days to fix

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

    module.exports = (app, conf = {}) => {
      const AdminUtils = adminUtils(app);
      const { baseUrl = 'admin' } = conf;
      const { errors } = AdminUtils;
      const { created } = app.handler;
    Severity: Major
    Found in lib/update.js - About 3 hrs to fix

      Function select has 78 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const select = (el) => {
        const data = el.data();
        const { ref, display, value, qtype, placeholder } = data;
        const isMultiple = el.attr('multiple') === 'multiple';
        const { sort = display } = data;
      Severity: Major
      Found in assets/js/scripts/fields/relation.js - About 3 hrs to fix

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

        module.exports = (app) => {
          const { Validate } = app.service('System');
          const mongoose = app.service('Mongoose');
          const Plugin = app.service('PluginService');
          const ObjectId = mongoose.Schema.Types.ObjectId;
        Severity: Major
        Found in example/model/test.js - About 2 hrs to fix

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

          function FastClick(layer) {
              'use strict';
              var oldOnClick, self = this;
          
          
          
          Severity: Major
          Found in assets/lib/switchery/dist/switchery.js - About 2 hrs to fix

            Function Admin has 59 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports = function Admin(app, config) {
              const getConf = config || app.config('admin');
              if (!getConf) {
                return log('config not found!');
              }
            Severity: Major
            Found in index.js - About 2 hrs to fix

              Function exports has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

              module.exports = (app, njk) => {
                function FieldExtension() {
                  this.tags = ['field'];
                  this.parse = parse('field', this);
              
              
              Severity: Minor
              Found in lib/extension/field.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 object has 51 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  object(req, res, next) {
                    const { object, id: objectId } = req.params;
                    const body = _.omit(req.body, _.isEmpty);
                    let modelData;
              
              
              Severity: Major
              Found in lib/update.js - About 2 hrs to fix

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

                FastClick.prototype.onTouchEnd = function(event) {
                    'use strict';
                    var forElement, trackingClickStart, targetTagName, scrollParent, touch, targetElement = this.targetElement;
                
                    if (!this.trackingClick) {
                Severity: Major
                Found in assets/lib/switchery/dist/switchery.js - About 2 hrs to fix

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

                  module.exports = (app, njk) => {
                    const AdminUtils = adminUtils(app);
                  
                    function PaginateExtension() {
                      this.tags = ['paginate'];
                  Severity: Major
                  Found in lib/extension/paginate.js - About 2 hrs to fix

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

                    module.exports = (app, conf = {}) => {
                      const AdminUtils = adminUtils(app);
                      const { baseUrl = 'admin' } = conf;
                      const { errors } = AdminUtils;
                      const { created } = app.handler;
                    Severity: Minor
                    Found in lib/create.js - About 1 hr to fix

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

                      const select2nested = (data, valueField, displayField, isMultiple, prefix, initPrefix = '-') => {
                        let r = [];
                        let getPrefix = prefix;
                        if (!getPrefix) {
                          getPrefix = isMultiple ? '' : `${initPrefix} `;
                      Severity: Minor
                      Found in assets/js/scripts/fields/relation.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 PaginateExtension has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        function PaginateExtension() {
                          this.tags = ['paginate'];
                          this.parse = parse('paginate', this);
                      
                          this.run = (context, params = {}, q = {}, options = {}, body, errorBody, cb) => {
                      Severity: Minor
                      Found in lib/extension/paginate.js - About 1 hr to fix

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

                        module.exports = (app, conf = {}, viewsPath, router) => {
                          const env = app.get('env');
                        
                          const {
                            baseUrl = 'admin',
                        Severity: Minor
                        Found in lib/middleware.js - About 1 hr to fix

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

                          module.exports = (app, njk) => {
                            const AdminUtils = adminUtils(app);
                          
                            function ApiQueryExtension() {
                              this.tags = ['apiquery'];
                          Severity: Minor
                          Found in lib/extension/apiQuery.js - About 1 hr to fix

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

                                this.run = (context, params = {}, q = {}, options = {}, body, errorBody, cb) => {
                                  const { object, querymen = {} } = context.ctx;
                                  const { model, name, pageBaseUrl } = params;
                                  let { page = 1, limit = 10, sort, populate = [] } = options;
                                  const queryName = name || object;
                            Severity: Minor
                            Found in lib/extension/paginate.js - About 1 hr to fix

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

                              module.exports = (app, njk) => {
                                function FieldExtension() {
                                  this.tags = ['field'];
                                  this.parse = parse('field', this);
                              
                              
                              Severity: Minor
                              Found in lib/extension/field.js - About 1 hr to fix

                                Function onInitialize has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    onInitialize() {
                                      const self = this;
                                      const q = { limit: 100, sort };
                                
                                      if (qtype === 'fullArrayTree') {
                                Severity: Minor
                                Found in assets/js/scripts/fields/relation.js - About 1 hr to fix

                                  Function ApiQueryExtension has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    function ApiQueryExtension() {
                                      this.tags = ['apiquery'];
                                      this.parse = parse('apiquery', this);
                                  
                                      this.run = (context, params = {}, q = {}, options = {}, body, errorBody, cb) => {
                                  Severity: Minor
                                  Found in lib/extension/apiQuery.js - About 1 hr to fix

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

                                    module.exports = (app) => {
                                      const { models, baseUrl = 'admin' } = app.config('admin');
                                      const { cookie = 'locale' } = app.config('i18n');
                                      const { unprocessableEntity, notFound, internalServerError } = app.handler;
                                      const getModel = object => app.service('Mongoose').model(object);
                                    Severity: Minor
                                    Found in lib/utils.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language