getlackey/lackey-cms

View on GitHub

Showing 527 of 527 total issues

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

                lackey.bind('[data-next-month]', 'click', (event) => {
                    event.preventDefault();
                    event.stopPropagation();
                    self._viewing = new Date(Date.UTC(self._viewing.getUTCFullYear(), self._viewing.getUTCMonth() + 1, 1, 12, 0, 0, 0));
                    self.redraw(self.getOptions());
Severity: Major
Found in modules/cms/client/js/manager/datetime.picker.ui.js and 1 other location - About 4 hrs to fix
modules/cms/client/js/manager/datetime.picker.ui.js on lines 98..103

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

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

File wysiwyg.js has 337 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

    Function constructor has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

        constructor(element) {
            var
                self = this;
            this._search = lackey.select('[data-lky-hook="table.filter"]')[0];
            this._root = element;
    Severity: Minor
    Found in modules/core/client/js/table.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

    File module-loader.js has 336 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* jslint node:true, esnext:true, no-use-before-define */
    /* eslint no-use-before-define:0 */
    /* globals LACKEY_PATH */
    'use strict';
    
    
    Severity: Minor
    Found in lib/server/module-loader.js - About 4 hrs to fix

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

          function renderParameter(name, chunk, context, bodies, params) {
              if (params && params[name]) {
                  if (typeof params[name] === 'function') {
                      var output = '';
                      chunk.tap(function (data) {
      Severity: Major
      Found in modules/core/shared/dust/path.js and 1 other location - About 4 hrs to fix
      modules/cms/server/lib/dust/editable.js on lines 43..57

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

      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

      function renderParameter(name, chunk, context, bodies, params) {
        if (params && params[name]) {
          if (typeof params[name] === 'function') {
            var output = '';
            chunk.tap(function (data) {
      Severity: Major
      Found in modules/cms/server/lib/dust/editable.js and 1 other location - About 4 hrs to fix
      modules/core/shared/dust/path.js on lines 22..36

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

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

          .then((Model, Crud) => {
              class Controller extends Crud {
      
                  static get model() {
                      return this._overriden('model', Model);
      Severity: Major
      Found in modules/cms/server/controllers/media.js - About 4 hrs to fix

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

        function print(chunk, data, type, editMode, dust, log, config) {
          let source;
        
          SCli.debug('lackey-cms/modules/cms/server/lib/dust/media', 'Print', JSON.stringify(data, null, 4));
        
        
        Severity: Major
        Found in modules/cms/server/lib/dust/media.js - About 4 hrs to fix

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

          module.exports = function (el, cb) {
              var root = el || document,
                  callback = cb || function () {};
          
              lackey.bind('[data-lky-hook="action:pick-taxonomy"]', 'click', (event, hook) => {
          Severity: Major
          Found in modules/cms/client/js/profile.js - About 3 hrs to fix

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

                                .then(() => {
                                    req.login(user, function (error) {
                                        if (error) {
                                            /* istanbul ignore next */
                                            res.status(400).error(error);
            Severity: Major
            Found in modules/users/server/controllers/account.js and 1 other location - About 3 hrs to fix
            modules/users/server/controllers/account.js on lines 174..184

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

            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

                                    user.save().then(() => {
                                        req.login(user, function (error) {
                                            if (error) {
                                                /* istanbul ignore next */
                                                res.status(400).error(error);
            Severity: Major
            Found in modules/users/server/controllers/account.js and 1 other location - About 3 hrs to fix
            modules/users/server/controllers/account.js on lines 151..161

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

            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 3 locations. Consider refactoring.
            Open

                        static details(req, res) {
                            Model
                                .findById(req.params.media_id)
                                .then(media => {
                                    if (media) {
            Severity: Major
            Found in modules/cms/server/controllers/media.js and 2 other locations - About 3 hrs to fix
            modules/cms/server/controllers/content.js on lines 105..119
            modules/cms/server/controllers/taxonomy.js on lines 72..86

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

            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 3 locations. Consider refactoring.
            Open

                        static details(req, res) {
                            Model
                                .findById(req.params.content_id)
                                .then(content => {
                                    if (content) {
            Severity: Major
            Found in modules/cms/server/controllers/content.js and 2 other locations - About 3 hrs to fix
            modules/cms/server/controllers/media.js on lines 121..135
            modules/cms/server/controllers/taxonomy.js on lines 72..86

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

            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 3 locations. Consider refactoring.
            Open

                        static details(req, res) {
                            Model
                                .findById(req.params.taxonomy_id)
                                .then(taxonomy => {
                                    if (taxonomy) {
            Severity: Major
            Found in modules/cms/server/controllers/taxonomy.js and 2 other locations - About 3 hrs to fix
            modules/cms/server/controllers/content.js on lines 105..119
            modules/cms/server/controllers/media.js on lines 121..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 113.

            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

            function loadYAMLRoutes(name, express) {
            
                SCli.debug(__MODULE_NAME, 'loadYAMLRoutes ' + name);
            
                if (loadedModules[name].routes) {
            Severity: Major
            Found in lib/server/module-loader.js and 1 other location - About 3 hrs to fix
            lib/server/module-loader.js on lines 502..513

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

            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

                remove() {
                    return new Promise(resolve => {
                        let self = this,
                            handler = () => {
                                self.node.removeEventListener('transitionend', handler, false);
            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/picker.ui.js on lines 125..138

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

            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

                remove() {
                    return new Promise(resolve => {
                        let self = this,
                            handler = () => {
                                self.node.removeEventListener('transitionend', handler, false);
            Severity: Major
            Found in modules/cms/client/js/manager/picker.ui.js and 1 other location - About 3 hrs to fix
            modules/cms/client/js/manager/gallery.ui.js on lines 340..353

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

            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

            function loadYAMLRouteParameters(name, express) {
            
                SCli.debug(__MODULE_NAME, 'loadYAMLRoutes ' + name);
            
                if (loadedModules[name].routeParams) {
            Severity: Major
            Found in lib/server/module-loader.js and 1 other location - About 3 hrs to fix
            lib/server/module-loader.js on lines 455..466

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

            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

            Manager.prototype.getProperty = function (contentId, path, variant, schema) {
            
                return this.repository
                    .get('content', contentId)
                    .then(content => {
            Severity: Major
            Found in modules/cms/client/js/manager/index.js and 1 other location - About 3 hrs to fix
            modules/cms/client/js/manager/index.js on lines 166..177

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

            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

            Manager.prototype.get = function (contentId, path, variant, schema) {
            
                return this.repository
                    .get('content', contentId)
                    .then(content => {
            Severity: Major
            Found in modules/cms/client/js/manager/index.js and 1 other location - About 3 hrs to fix
            modules/cms/client/js/manager/index.js on lines 203..214

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

            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