getlackey/lackey-cms

View on GitHub

Showing 527 of 527 total issues

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

            invalidatePasswordToken(token) {

                SCli.debug(__MODULE_NAME, 'invalidatePasswordToken');

                let self = this;
Severity: Major
Found in modules/core/server/models/user/index.js and 1 other location - About 1 day to fix
modules/core/server/models/user/index.js on lines 486..514

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

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

    .then((User, Session) => {
        return {
            index: (req, res) => {

                let data = {};
Severity: Major
Found in modules/users/server/controllers/account.js - About 1 day to fix

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

        .then((Model, Template, Taxonomy, Crud) => {
            class ContentCtrl extends Crud {
    
                static get model() {
                    return this._overriden('model', Model);
    Severity: Major
    Found in modules/cms/server/controllers/content.js - About 1 day to fix

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

          .then((Taggable, User, Taxonomy, TaxonomyType, Template, knexSchema, QueryBuilder, configuration) => {
      
              SCli.debug(__MODULE_NAME, 'READY');
      
              class ContentModel extends Model {
      Severity: Minor
      Found in modules/core/server/models/content/index.js - About 1 day 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 knex.js has 501 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /* eslint no-underscore-dangle:0 */
      /* jslint node:true, esnext:true */
      /* global LACKEY_PATH */
      'use strict';
      
      
      Severity: Major
      Found in modules/core/server/models/knex.js - About 1 day to fix

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

        module.exports = (dust) => {
        
            function renderParameter(name, chunk, context, bodies, params) {
                if (params && params[name]) {
                    if (typeof params[name] === 'function') {
        Severity: Minor
        Found in modules/core/shared/dust/path.js - About 7 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 format has 192 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports.format = (req, res, next) => {
            var isYAML = (/(.*).yaml/).test(req.path),
                isJSON = !isYAML && ((/(.*).json$/).test(req.path) || (/^\/api\//).test(req.path)),
                isXLS = !isJSON && !isYAML && (/(.*).xlsx/).test(req.path),
                isHTML = !isJSON && !isYAML && !isXLS;
        Severity: Major
        Found in lib/server/init/format.js - About 7 hrs to fix

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

          module.exports = function (connect) {
          
              /**
               * Connect's Store.
               */
          Severity: Major
          Found in modules/users/server/lib/connect-session-knex/index.js - About 7 hrs to fix

            Function table has 187 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                                static table(inputQuery, inputColumns, options) {
                                    SCli.debug(__MODULE_NAME, 'table', this.model.tableName, JSON.stringify(inputQuery), JSON.stringify(inputColumns), JSON.stringify(options));
                                    let
                                        query,
                                        columns = inputColumns,
            Severity: Major
            Found in modules/core/server/models/objection/index.js - About 7 hrs to fix

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

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

                Function constructor has 178 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    constructor(element) {
                        var
                            self = this;
                        this._search = lackey.select('[data-lky-hook="table.filter"]')[0];
                        this._root = element;
                Severity: Major
                Found in modules/core/client/js/table.js - About 7 hrs to fix

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

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

                    File block-editor.js has 443 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

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

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

                      module.exports = (gulp, projectDIR) => {
                      
                          let lackeyDIR = path.resolve(__dirname + '/..'),
                              htDocs = projectDIR + '/htdocs';
                      
                      
                      Severity: Major
                      Found in gulp/index.js - About 6 hrs to fix

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

                        module.exports = () => new Promise((resolve, reject) => {
                                atomus()
                                    .html('<html></html>')
                                    .ready(function (errors, window) {
                                        try {
                        Severity: Major
                        Found in modules/core/server/models/content/upgrade.js - About 6 hrs to fix

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

                          module.exports = () => new Promise((resolve, reject) => {
                                  atomus()
                                      .html('<html></html>')
                                      .ready(function (errors, window) {
                                          try {
                          Severity: Minor
                          Found in modules/core/server/models/content/upgrade.js - About 6 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 40 (exceeds 5 allowed). Consider refactoring.
                          Open

                          module.exports = dust => {
                          
                            /**
                             * Editable DUSTJS helper
                             * @param   {Chunk} chunk
                          Severity: Minor
                          Found in modules/cms/server/lib/dust/editable.js - About 6 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

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

                              return new Promise((resolve, reject) => {
                          
                                  engine.render(name, vars, function (err, html) {
                                      if (err) {
                                          return reject(err);
                          Severity: Major
                          Found in modules/core/client/js/template.js and 1 other location - About 6 hrs to fix
                          modules/core/client/js/es5/template.js on lines 66..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 156.

                          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

                              return new Promise(function (resolve, reject) {
                          
                                  engine.render(name, vars, function (err, html) {
                                      if (err) {
                                          return reject(err);
                          Severity: Major
                          Found in modules/core/client/js/es5/template.js and 1 other location - About 6 hrs to fix
                          modules/core/client/js/template.js on lines 102..122

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

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

                              .then((Taggable) => {
                          
                                  SCli.debug(__MODULE_NAME, 'READY');
                          
                                  require('./generator');
                          Severity: Major
                          Found in modules/core/server/models/role/index.js - About 5 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language