getlackey/lackey-cms

View on GitHub

Showing 527 of 527 total issues

Function render has 140 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    render() {

        debug('render');

        let
Severity: Major
Found in modules/cms/client/js/wysiwyg.js - About 5 hrs to fix

    File index.js has 399 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* eslint no-underscore-dangle:0 */
    /* jslint node:true, esnext:true */
    /* globals LACKEY_PATH */
    'use strict';
    
    
    Severity: Minor
    Found in modules/core/server/models/content/index.js - About 5 hrs to fix

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

          pickUser(settings, event, hook) {
              this.collapse();
              let self = this,
                  user = hook.getAttribute('data-value');
      
      
      Severity: Major
      Found in modules/cms/client/js/manager/structure.ui.js and 1 other location - About 5 hrs to fix
      modules/cms/client/js/manager/structure.ui.js on lines 698..713

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

      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

          pickDateTime(settings, event, hook) {
              this.collapse();
              let self = this,
                  date = hook.getAttribute('data-value');
      
      
      Severity: Major
      Found in modules/cms/client/js/manager/structure.ui.js and 1 other location - About 5 hrs to fix
      modules/cms/client/js/manager/structure.ui.js on lines 715..730

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

      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 a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

      module.exports = function (connect) {
      
          /**
           * Connect's Store.
           */
      Severity: Minor
      Found in modules/users/server/lib/connect-session-knex/index.js - About 5 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 a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

          .then((Taggable, QueryBuilder) => {
      
              SCli.debug(__MODULE_NAME, 'READY');
      
              class MediaModel extends Model {
      Severity: Minor
      Found in modules/core/server/models/media/index.js - About 5 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

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

      dragdrop.on('done', function (uploader, data) {
            if (data && data.length && data[0].data) {
                  media.set(data[0].data);
                  media.notify();
                  api.update('/me', {avatar: media.media.id}).then(() => {
      Severity: Major
      Found in modules/users/client/js/account.js and 1 other location - About 5 hrs to fix
      modules/users/client/js/account.js on lines 59..71

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

      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

              media.upload.on('done', function (uploader, data) {
                  if (data && data.length && data[0].data) {
                      media.set(data[0].data);
                      media.notify();
                      api.update('/me', {avatar: media.media.id}).then(() => {
      Severity: Major
      Found in modules/users/client/js/account.js and 1 other location - About 5 hrs to fix
      modules/users/client/js/account.js on lines 75..87

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

      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 129 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          .then((Role, User, TaxonomyType, Taxonomy, Template, Media, Content) => {
      
              class Serializer {
                  static all() {
                      let result = {};
      Severity: Major
      Found in modules/cms/server/lib/serializer.js - About 5 hrs to fix

        Function ajax has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
        Open

                ajax: function (path, method, data, raw) {
        
                    return new Promise(function (resolve, reject) {
        
                        var xhr = new XMLHttpRequest(),
        Severity: Minor
        Found in modules/core/client/js/es5/xhr.js - About 5 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 page.js has 378 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/cms/server/controllers/page.js - About 5 hrs to fix

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

              static removeTaxonomy(Taxonomy, req, res) {
                  let self = this;
                  this
                      .taxonomyFromQuery(Taxonomy, {
                          type: req.taxonomyTypeName,
          Severity: Major
          Found in modules/core/server/controllers/crud.injection.js and 1 other location - About 5 hrs to fix
          modules/cms/server/controllers/content.js on lines 215..231

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

          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

                      static removeTaxonomy(req, res) {
                          let self = this;
                          this
                              .taxonomyFromQuery(Taxonomy, {
                                  type: req.taxonomyTypeName,
          Severity: Major
          Found in modules/cms/server/controllers/content.js and 1 other location - About 5 hrs to fix
          modules/core/server/controllers/crud.injection.js on lines 97..113

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

          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 126 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              .then((knex) => {
          
                  class ContentQueryBuilder {
          
                      constructor() {
          Severity: Major
          Found in modules/core/server/models/content/querybuilder.js - About 5 hrs to fix

            Function lookup has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
            Open

            module.exports.lookup = (lackeyPath, projectPath) => {
            
                let fn = (_path, options, callback) => {
            
                    if (typeof _path === 'string' && _path.indexOf(',') >= 0) {
            Severity: Minor
            Found in lib/server/init/views.js - About 4 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

            StructureUI has 37 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class StructureUI extends Emitter {
            
                /**
                 * Gets template meta data
                 * @param   {string} templatePath
            Severity: Minor
            Found in modules/cms/client/js/manager/structure.ui.js - About 4 hrs to fix

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

              module.exports = (dust, config) => {
              
                dust.filters.media = function (value) {
                  var returnString = '';
                  if (value.mime === 'video/youtube') {
              Severity: Major
              Found in modules/cms/server/lib/dust/media.js - About 4 hrs to fix

                Function print has 117 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                            static print(page, fullPath, res, req, preview) {
                
                                let
                                    path,
                                    user = req.user,
                Severity: Major
                Found in modules/cms/server/controllers/page.js - About 4 hrs to fix

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

                                  req.admin.setIdentity('email', req.body.email, null, null, null, false, true)
                                      .then(() => {
                                          let data = {};
                                          req.admin
                                              .getIdentities('email')
                  Severity: Major
                  Found in modules/users/server/controllers/account.js and 1 other location - About 4 hrs to fix
                  modules/users/server/controllers/account.js on lines 243..259

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

                  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

                                              req.admin.removeIdentity('email', req.body.email)
                                                  .then(() => {
                                                      let data = {};
                                                      req.admin
                                                          .getIdentities('email')
                  Severity: Major
                  Found in modules/users/server/controllers/account.js and 1 other location - About 4 hrs to fix
                  modules/users/server/controllers/account.js on lines 208..224

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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language