getlackey/lackey-cms

View on GitHub

Showing 527 of 527 total issues

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

function validPass(pass) { // TODO: move to backend
    if (!pass || pass.length < 6) return false;
    if (!pass.match(/\d+/g)) return false;
    if (!pass.match(/[a-zA-Z]+/g)) return false;
    if (!pass.match(/[^a-zA-Z0-9\d\s]/g)) return false;
Severity: Major
Found in modules/cms/client/js/new-user-password.js and 2 other locations - About 2 hrs to fix
modules/users/client/js/account.js on lines 121..127
modules/users/client/js/reset-password.js on lines 26..32

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

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

function validPass(pass) { // TODO: move to backend
    if (!pass || pass.length < 6) return false;
    if (!pass.match(/\d+/g)) return false;
    if (!pass.match(/[a-zA-Z]+/g)) return false;
    if (!pass.match(/[^a-zA-Z0-9\d\s]/g)) return false;
Severity: Major
Found in modules/users/client/js/account.js and 2 other locations - About 2 hrs to fix
modules/cms/client/js/new-user-password.js on lines 28..34
modules/users/client/js/reset-password.js on lines 26..32

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

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

function validPass(pass) { // TODO: move to backend
    if (!pass || pass.length < 6) return false;
    if (!pass.match(/\d+/g)) return false;
    if (!pass.match(/[a-zA-Z]+/g)) return false;
    if (!pass.match(/[^a-zA-Z0-9\d\s]/g)) return false;
Severity: Major
Found in modules/users/client/js/reset-password.js and 2 other locations - About 2 hrs to fix
modules/cms/client/js/new-user-password.js on lines 28..34
modules/users/client/js/account.js on lines 121..127

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

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

    buildUI() {

        let
            self = this,
            ignore = lackey.select('[data-lky-hook="header.settings"]')[0].getAttribute('data-lky-ignore').split(',');
Severity: Major
Found in modules/cms/client/js/manager/structure.ui.js - About 2 hrs to fix

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

    module.exports = dust => {
    
      /**
       * Editable DUSTJS helper
       * @param   {Chunk} chunk
    Severity: Major
    Found in modules/cms/server/lib/dust/editable.js - About 2 hrs to fix

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

          res.css = (listOrOne) => {
              if (typeof listOrOne === 'string') {
                  res.__doc.stylesheets.push(listOrOne);
              } else {
                  res.__doc.stylesheets = res.__doc.stylesheets.concat(listOrOne);
      Severity: Major
      Found in lib/server/init/format.js and 1 other location - About 2 hrs to fix
      lib/server/init/format.js on lines 262..268

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

      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 (options.next) {
                              this.next = options.next;
                              lackey.hide(this.next);
                              lackey.bind(this.next, 'click', () => {
                                    self.page += 1;
      Severity: Major
      Found in modules/cms/client/js/manager/media.js and 1 other location - About 2 hrs to fix
      modules/cms/client/js/manager/media.js on lines 36..43

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

      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

          res.js = (listOrOne) => {
              if (typeof listOrOne === 'string') {
                  res.__doc.javascripts.push(listOrOne);
              } else {
                  res.__doc.javascripts = res.__doc.javascripts.concat(listOrOne);
      Severity: Major
      Found in lib/server/init/format.js and 1 other location - About 2 hrs to fix
      lib/server/init/format.js on lines 253..260

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

      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 (options.prev) {
                              this.prev = options.prev;
                              lackey.hide(this.prev);
                              lackey.bind(this.prev, 'click', () => {
                                    self.page -= 1;
      Severity: Major
      Found in modules/cms/client/js/manager/media.js and 1 other location - About 2 hrs to fix
      modules/cms/client/js/manager/media.js on lines 44..51

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

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

        dust.helpers.editable = function (chunk, context, bodies, params) {
      
          let
            editMode = params.editMode !== undefined ? params.editMode : context.get('edit'),
            content = params.content,
      Severity: Major
      Found in modules/cms/server/lib/dust/editable.js - About 2 hrs to fix

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

            constructor(options) {
        
                super();
                this.options = options;
                this._locked = null;
        Severity: Major
        Found in modules/cms/client/js/manager/picker.ui.js and 1 other location - About 2 hrs to fix
        modules/cms/client/js/manager/gallery.ui.js on lines 45..54

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

        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

            constructor(options) {
                super();
                this.options = options;
                this._locked = null;
                let self = this;
        Severity: Major
        Found in modules/cms/client/js/manager/gallery.ui.js and 1 other location - About 2 hrs to fix
        modules/cms/client/js/manager/picker.ui.js on lines 34..46

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

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

                    _preSave() {
        
                        return super
                            ._preSave()
                            .then(self => {
        Severity: Major
        Found in modules/core/server/models/template/index.js - About 2 hrs to fix

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

          Manager.prototype.insertAfter = function (contentId, path, variant, value) {
              return this
                  .update('content', contentId, function (content) {
                      treeParser.insertAfter(content.layout, path, value, variant || '*', null, locale !== defaultLocale ? locale : '*');
                  });
          Severity: Major
          Found in modules/cms/client/js/manager/index.js and 2 other locations - About 2 hrs to fix
          modules/cms/client/js/manager/index.js on lines 187..192
          modules/cms/client/js/manager/index.js on lines 224..229

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

          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

          Manager.prototype.setProperty = function (contentId, path, variant, value) {
              return this
                  .update('content', contentId, function (content) {
                      treeParser.set(content.props, path, value, variant || '*', null, locale !== defaultLocale ? locale : '*');
                  });
          Severity: Major
          Found in modules/cms/client/js/manager/index.js and 2 other locations - About 2 hrs to fix
          modules/cms/client/js/manager/index.js on lines 187..192
          modules/cms/client/js/manager/index.js on lines 240..245

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

          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

          Manager.prototype.set = function (contentId, path, variant, value) {
              return this
                  .update('content', contentId, function (content) {
                      treeParser.set(content.layout, path, value, variant || '*', null, locale !== defaultLocale ? locale : '*');
                  });
          Severity: Major
          Found in modules/cms/client/js/manager/index.js and 2 other locations - About 2 hrs to fix
          modules/cms/client/js/manager/index.js on lines 224..229
          modules/cms/client/js/manager/index.js on lines 240..245

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

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

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

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

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

              .then((FlyWeight, TaxonomyType) => {
          
                  SCli.debug(__MODULE_NAME, 'READY');
          
                  class TaxonomyModel extends Model {
          Severity: Minor
          Found in modules/core/server/models/taxonomy/index.js - About 2 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function mapDictionary has 55 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              mapDictionary(data) {
                  data.dictionary = Object
                      .keys(data.dictionary)
                      .map(key => {
                          let value = data.dictionary[key];
          Severity: Major
          Found in modules/cms/client/js/manager/structure.ui.js - About 2 hrs to fix

            Function video_embed has 55 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function video_embed(md, options) {
              function video_return(state, silent) {
                var serviceEnd,
                  serviceStart,
                  token,
            Severity: Major
            Found in modules/cms/shared/video/viewmode.js - About 2 hrs to fix
              Severity
              Category
              Status
              Source
              Language