getlackey/lackey-cms

View on GitHub

Showing 527 of 527 total issues

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

    .then((ObjectionWrapper, Taxonomy) => {

        SCli.debug(__MODULE_NAME, 'READY');

        /**
Severity: Major
Found in modules/core/server/models/taggable/index.js - About 4 hrs to fix

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

    module.exports = SUtils
        .waitForAs('lackey-cms/modules/cms/server/controllers/translation',
            SUtils.cmsMod('core').model('translation'),
            SUtils.cmsMod('core').controller('crud')
        )
    Severity: Major
    Found in modules/cms/server/controllers/translation.js and 2 other locations - About 4 hrs to fix
    modules/cms/server/controllers/role.js on lines 22..41
    modules/cms/server/controllers/template.js on lines 21..40

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

    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

    module.exports = SUtils
        .waitForAs('lackey-cms/modules/cms/server/controllers/role',
            SUtils.cmsMod('core').model('role'),
            SUtils.cmsMod('core').controller('crud')
        )
    Severity: Major
    Found in modules/cms/server/controllers/role.js and 2 other locations - About 4 hrs to fix
    modules/cms/server/controllers/template.js on lines 21..40
    modules/cms/server/controllers/translation.js on lines 22..41

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

    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

    module.exports = SUtils
        .waitForAs('templateCtrl',
            SUtils.cmsMod('core').model('template'),
            SUtils.cmsMod('core').controller('crud')
        )
    Severity: Major
    Found in modules/cms/server/controllers/template.js and 2 other locations - About 4 hrs to fix
    modules/cms/server/controllers/role.js on lines 22..41
    modules/cms/server/controllers/translation.js on lines 22..41

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

    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 31 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports = (dust, config) => {
    
      dust.filters.media = function (value) {
        var returnString = '';
        if (value.mime === 'video/youtube') {
    Severity: Minor
    Found in modules/cms/server/lib/dust/media.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 index.js has 357 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* jslint esnext:true, node:true */
    /* globals LACKEY_PATH */
    'use strict';
    
    /*
    Severity: Minor
    Found in modules/core/server/models/media/index.js - About 4 hrs to fix

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

                  if (data.type === 'Fields' || data.type === 'Variants') {
                      Object.keys(data)
                          .forEach(key => {
                              if (['type'].indexOf(key) === -1) {
                                  let content = data[key];
      Severity: Major
      Found in modules/core/server/models/content/upgrade.js and 1 other location - About 4 hrs to fix
      modules/core/server/models/content/serializer.js on lines 144..153

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

      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

          if (data.type === 'Fields' || data.type === 'Variants') {
              Object.keys(data).forEach((key) => {
                  if (['type'].indexOf(key) === -1) {
                      let content = data[key];
                      promises.push(crawlBack(content).then((output) => {
      Severity: Major
      Found in modules/core/server/models/content/serializer.js and 1 other location - About 4 hrs to fix
      modules/core/server/models/content/upgrade.js on lines 269..280

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

      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

              Role
                  .findOneBy('name', req.roleName)
                  .then(role => {
                      return role.canCreate(req.admin).then(canEdit => canEdit ? role : null);
                  })
      Severity: Major
      Found in modules/cms/server/controllers/user.js and 1 other location - About 4 hrs to fix
      modules/cms/server/controllers/user.js on lines 156..175

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

      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

              Role
                  .findOneBy('name', req.roleName)
                  .then(role => {
                      return role.canCreate(req.admin).then(canEdit => canEdit ? role : null);
                  })
      Severity: Major
      Found in modules/cms/server/controllers/user.js and 1 other location - About 4 hrs to fix
      modules/cms/server/controllers/user.js on lines 192..209

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

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

      module.exports = (socket, config) => {
      
      
          socket.on('media.start-upload', (data) => {
              console.log('media.start-upload', data);
      Severity: Major
      Found in modules/core/server/models/media/sockets.js - About 4 hrs to fix

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

            ['fields', 'variants', 'items'].forEach((group) => {
                if (data[group]) {
                    Object.keys(data[group]).forEach((key) => {
                        let content = data[group][key];
                        promises.push(crawlBack(content).then((output) => {
        Severity: Major
        Found in modules/core/server/models/content/serializer.js and 1 other location - About 4 hrs to fix
        modules/core/server/models/content/upgrade.js on lines 255..267

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

        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

            ['fields', 'variants', 'items']
                    .forEach(group => {
                        if (data[group]) {
                            Object.keys(data[group])
                                .forEach(key => {
        Severity: Major
        Found in modules/core/server/models/content/upgrade.js and 1 other location - About 4 hrs to fix
        modules/core/server/models/content/serializer.js on lines 133..142

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

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

            .then((ObjectionWrapper) => {
                SCli.debug(__MODULE_NAME, 'READY');
        
                class AnalyticsModel extends Model {
                    static get tableName() {
        Severity: Major
        Found in modules/core/server/models/analytics/index.js - About 4 hrs to fix

          BlockEditor has 33 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class BlockEditor {
              constructor(path, template, block) {
                  debug('Constructor', block);
          
                  var self = this;
          Severity: Minor
          Found in modules/cms/client/js/block-editor.js - About 4 hrs to fix

            Function block has 103 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports.block = (config, injectedChunk, context, bodies, params, dust) => {
            
              SCli.debug('lackey-cms/modules/cms/server/lib/dust/block');
            
              if (!config) {
            Severity: Major
            Found in modules/cms/server/lib/dust/block.js - About 4 hrs to fix

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

              module.exports = function (el, cb) {
                  var media,
                      dragdrop,
                      root = el || document,
                      callback = cb || function () {},
              Severity: Major
              Found in modules/cms/client/js/new-media.js - About 4 hrs to fix

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

                                if (Math.abs(outline.bounds.top) < 5 &&
                                   Math.abs(outline.bounds.height - bounds.height) < 5) {
                                    outline.classList.add('full-height');
                                } else if (Math.abs(outline.bounds.top) < 5) {
                                    outline.classList.add('at-top');
                Severity: Major
                Found in modules/cms/client/js/block-editor.js and 1 other location - About 4 hrs to fix
                modules/cms/client/js/block-editor.js on lines 476..481

                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

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

                                lackey.bind('[data-previous-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 105..110

                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

                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

                Severity
                Category
                Status
                Source
                Language