getlackey/lackey-cms

View on GitHub

Showing 527 of 527 total issues

File crud.injection.js has 324 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* jslint esnext:true, node:true */
/* globals LACKEY_PATH */
'use strict';
/*
    Copyright 2016 Enigma Marketing Services Limited
Severity: Minor
Found in modules/core/server/controllers/crud.injection.js - About 3 hrs to fix

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

                removeOtherIdentity(provider, id) {
    
                    SCli.debug(__MODULE_NAME, 'removeOtherIdentity', provider, id);
    
                    return SCli
    Severity: Major
    Found in modules/core/server/models/user/index.js and 1 other location - About 3 hrs to fix
    modules/core/server/models/user/index.js on lines 1074..1088

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

    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

                removeIdentity(provider, id) {
    
                    SCli.debug(__MODULE_NAME, 'removeIdentity', provider, id);
    
                    return SCli
    Severity: Major
    Found in modules/core/server/models/user/index.js and 1 other location - About 3 hrs to fix
    modules/core/server/models/user/index.js on lines 1090..1104

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

    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

                if (b.columns[field].value && b.columns[field].value.date) {
                    fieldB = b.columns[field].value.date;
                } else if (b.columns[field].value) {
                    fieldB = b.columns[field].value.toLocaleLowerCase();
                }
    Severity: Major
    Found in modules/core/client/js/table.js and 1 other location - About 3 hrs to fix
    modules/core/client/js/table.js on lines 536..540

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

    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

                if (a.columns[field].value && a.columns[field].value.date) {
                    fieldA = a.columns[field].value.date;
                } else if (a.columns[field].value) {
                    fieldA = a.columns[field].value.toLocaleLowerCase();
                }
    Severity: Major
    Found in modules/core/client/js/table.js and 1 other location - About 3 hrs to fix
    modules/core/client/js/table.js on lines 542..546

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

    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

    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

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

              toggle(event) {
          
                  event.preventDefault();
                  event.stopPropagation();
          
          
          Severity: Major
          Found in modules/cms/client/js/manager/gallery.ui.js and 1 other location - About 3 hrs to fix
          modules/cms/client/js/manager/structure.ui.js on lines 793..805

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

          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

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

              toggle(event) {
                  event.preventDefault();
                  event.stopPropagation();
          
                  let toOpen = event.target.getAttribute('data-lky-open'),
          Severity: Major
          Found in modules/cms/client/js/manager/structure.ui.js and 1 other location - About 3 hrs to fix
          modules/cms/client/js/manager/gallery.ui.js on lines 355..368

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

          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

          Identical blocks of code found in 3 locations. Consider refactoring.
          Open

              if (arguments.length === 1) {
                  contentId = arguments[0];
                  type = contentId.split('-')[0];
                  id = contentId.split('-')[1];
              } else {
          Severity: Major
          Found in modules/cms/client/js/manager/repository.js and 2 other locations - About 3 hrs to fix
          modules/cms/client/js/manager/repository.js on lines 127..135
          modules/cms/client/js/manager/repository.js on lines 174..182

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

          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

          Identical blocks of code found in 3 locations. Consider refactoring.
          Open

              if (arguments.length === 1) {
                  contentId = arguments[0];
                  type = contentId.split('-')[0];
                  id = contentId.split('-')[1];
              } else {
          Severity: Major
          Found in modules/cms/client/js/manager/repository.js and 2 other locations - About 3 hrs to fix
          modules/cms/client/js/manager/repository.js on lines 61..69
          modules/cms/client/js/manager/repository.js on lines 174..182

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

          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

          Identical blocks of code found in 3 locations. Consider refactoring.
          Open

              if (arguments.length === 1) {
                  contentId = arguments[0];
                  type = contentId.split('-')[0];
                  id = contentId.split('-')[1];
              } else {
          Severity: Major
          Found in modules/cms/client/js/manager/repository.js and 2 other locations - About 3 hrs to fix
          modules/cms/client/js/manager/repository.js on lines 61..69
          modules/cms/client/js/manager/repository.js on lines 127..135

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

          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

          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
                      Severity
                      Category
                      Status
                      Source
                      Language