getlackey/lackey-cms

View on GitHub

Showing 324 of 527 total issues

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

    .then((Activity, Role, Language, Template, Content, Serializer, JSON2YAML) => {

        return {
            viewingAs: (req, res) => {
                res.api({
Severity: Major
Found in modules/cms/server/controllers/index.js - About 3 hrs to fix

    Function mapSource has 91 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                static mapSource(source) {
                    SCli.debug('lackey-cms/modules/media/server/models/media', 'mapSource', source);
                    if (typeof source === 'string') {
                        return Media.lookupMime(source)
                            .then((mime) => {
    Severity: Major
    Found in modules/core/server/models/media/index.js - About 3 hrs to fix

      Function setupUI has 90 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      Manager.prototype.setupUI = function () {
      
          let self = this,
              settingsButton = lackey.hook('header.settings');
      
      
      Severity: Major
      Found in modules/cms/client/js/manager/index.js - About 3 hrs to fix

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

            pageq(options) {
                var self = this,
                    page = this.pageNumber,
                    cloneData = this.data.rows.slice(),
                    pages,
        Severity: Major
        Found in modules/core/client/js/table.js - About 3 hrs to fix

          Function lookup has 83 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports.lookup = (lackeyPath, projectPath) => {
          
              let fn = (_path, options, callback) => {
          
                  if (typeof _path === 'string' && _path.indexOf(',') >= 0) {
          Severity: Major
          Found in lib/server/init/views.js - About 3 hrs to fix

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

            module.exports = (dust) => {
            
              dust.helpers.embed = function (chunk, context, bodies, params) {
            
                let
            Severity: Major
            Found in modules/cms/server/lib/dust/embed.js - About 3 hrs to fix

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

              module.exports.rest = (req, res, next) => {
              
                  req.getRESTQuery = (truncate) => {
              
                      let result = {
              Severity: Major
              Found in lib/server/init/rest.js - About 3 hrs to fix

                Function mapDictionary has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                Open

                    mapDictionary(data) {
                        data.dictionary = Object
                            .keys(data.dictionary)
                            .map(key => {
                                let value = data.dictionary[key];
                Severity: Minor
                Found in modules/cms/client/js/manager/structure.ui.js - About 3 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

                File gallery.ui.js has 301 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /* eslint no-cond-assign:0, no-new:0, no-alert:0 */
                /* jslint browser:true, node:true, esnext:true */
                'use strict';
                /*
                    Copyright 2016 Enigma Marketing Services Limited
                Severity: Minor
                Found in modules/cms/client/js/manager/gallery.ui.js - About 3 hrs to fix

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

                    dust.helpers.embed = function (chunk, context, bodies, params) {
                  
                      let
                        route = params.route + '',
                        template = params.template || false,
                  Severity: Major
                  Found in modules/cms/server/lib/dust/embed.js - About 3 hrs to fix

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

                        let fn = (_path, options, callback) => {
                    
                            if (typeof _path === 'string' && _path.indexOf(',') >= 0) {
                                /* express is stupid */
                                _path = _path.replace(/\.dust$/, '').split(',');
                    Severity: Major
                    Found in lib/server/init/views.js - About 3 hrs to fix

                      CRUDInjectionController has 27 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class CRUDInjectionController {
                      
                          static get field() {
                              throw new Error('You have to override this method');
                          }
                      Severity: Minor
                      Found in modules/core/server/controllers/crud.injection.js - About 3 hrs to fix

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

                        module.exports = (dust) => {
                            dust.helpers.sort = function (chunk, context, bodies, params) {
                                params.items.sort(function (a, b) {
                                    if (params.by) {
                                        return ((a[params.by] < b[params.by]) ? -1 : ((a[params.by] > b[params.by]) ? 1 : 0));
                        Severity: Minor
                        Found in modules/cms/server/lib/dust/sort.js - About 3 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 77 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        module.exports = (dust) => {
                        
                            function renderParameter(name, chunk, context, bodies, params) {
                                if (params && params[name]) {
                                    if (typeof params[name] === 'function') {
                        Severity: Major
                        Found in modules/core/shared/dust/path.js - About 3 hrs to fix

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

                              res.send = (data, forceFormat) => {
                          
                                  res.send = lSend;
                                  let output = {};
                                  output = _.merge(data);
                          Severity: Major
                          Found in lib/server/init/format.js - About 3 hrs to fix

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

                            module.exports = (server) => {
                            
                                return SUtils
                                    .waitForAs('cms routes',
                                        require('../controllers'),
                            Severity: Major
                            Found in modules/cms/server/routes/cms.routes.js - About 2 hrs to fix

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

                              function ModalController(rootNode, vars, resolve) {
                              
                                    let dummy,
                                          result = vars.media,
                                          repository;
                              Severity: Major
                              Found in modules/cms/client/js/manager/media.js - About 2 hrs to fix

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

                                    .then((ObjectionWrapper) => {
                                
                                        class LanguageModel extends Model {
                                            static get tableName() {
                                                return 'language';
                                Severity: Major
                                Found in modules/i18n/server/models/language/index.js - About 2 hrs to fix

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

                                  module.exports = (dust) => {
                                    dust.filters.media = function (value) {
                                        var returnString = '';
                                        if (value.mime === 'video/youtube') {
                                            returnString += '<iframe type="text/html" src="https://www.youtube.com/embed/' + isYoutube(value.source) + '" frameborder="0"></iframe>';
                                  Severity: Minor
                                  Found in modules/core/shared/dust/media.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 rest has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  module.exports.rest = (req, res, next) => {
                                  
                                      req.getRESTQuery = (truncate) => {
                                  
                                          let result = {
                                  Severity: Minor
                                  Found in lib/server/init/rest.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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language