getlackey/lackey-cms

View on GitHub

Showing 527 of 527 total issues

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

                        items: value.map((item) => {
                            if (typeof item === 'string') {
                                return {
                                    label: item,
                                    value: item
Severity: Major
Found in modules/cms/client/js/manager/structure.ui.js and 1 other location - About 1 hr to fix
modules/cms/client/js/manager/structure.ui.js on lines 888..897

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

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

            static get tableConfig() {
                return this._overriden('tableConfig', {
                    template: {
                        name: 'Template',
                        parse: 'return arguments[0] ? arguments[0].name : \'\''
Severity: Minor
Found in modules/cms/server/controllers/content.js - About 1 hr to fix

    Function bindLayout has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        bindLayout() {
            var self = this,
                sectionsRoot = lackey.hook('settings.blocks', self.node),
                blocksContainer = lackey.hook('sections', sectionsRoot),
                layoutContainer = lackey.hook('layout', sectionsRoot);
    Severity: Minor
    Found in modules/cms/client/js/manager/structure.ui.js - About 1 hr to fix

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

          static table(model, req, res) {
      
              let metric = this.metrics[req.metricIndex];
      
              model
      Severity: Minor
      Found in modules/analytics/server/controllers/dashboard.js - About 1 hr to fix

        Function getTemplate has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                getTemplate: function () {
                    var template = [
                        '<input type="text" class="medium-editor-toolbar-input" placeholder="', this.placeholderText, '">'
                    ];
        
        
        Severity: Minor
        Found in modules/cms/client/js/galleryhref.js - About 1 hr to fix

          Function crud has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              server.crud = function (path, name, middleware, endpoints) {
                  var
                      param = name + '_id',
                      singlePath = path + '/:' + param,
                      route = server.route(path),
          Severity: Minor
          Found in lib/server/init/crud.js - About 1 hr to fix

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

            module.exports = (data) => {
                return require('./index')
                    .then((user) => {
            
                        User = user;
            Severity: Minor
            Found in modules/core/server/models/user/generator.js - About 1 hr to fix

              Function api has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  api() {
                      let self = this;
                      lackey.bind('[data-lky-api]', 'click', (event, hook) => {
                          event.preventDefault();
                          let apiAction = hook.getAttribute('data-lky-api').split(':'),
              Severity: Minor
              Found in modules/core/client/js/table.js - About 1 hr to fix

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

                      constructor(root, options) {
                            let self = this;
                
                            this.page = 1;
                            this.total = 0;
                Severity: Minor
                Found in modules/cms/client/js/manager/media.js - About 1 hr 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 getOptions has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    getOptions() {
                        let options = this.options,
                            v = this._viewing,
                            firstOfMonth = new Date(Date.UTC(v.getUTCFullYear(), v.getUTCMonth(), 1, options.current.getUTCHours(), options.current.getUTCMinutes(), 0, 0)),
                            dow = firstOfMonth.getUTCDay() - 1,
                Severity: Minor
                Found in modules/cms/client/js/manager/datetime.picker.ui.js - About 1 hr 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 11 (exceeds 5 allowed). Consider refactoring.
                Open

                module.exports = function (dust) {
                
                    dust.helpers.youtube = function (chunk, context, bodies, params) {
                
                        var
                Severity: Minor
                Found in modules/core/shared/dust/youtube.js - About 1 hr 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 parse has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                function parse(data, readAs, asError) {
                  var format = readAs || 'json';
                  if (data === null || data === undefined) {
                    if (asError) {
                      throw new Error(null);
                Severity: Minor
                Found in modules/core/client/js/es5/api.js - About 1 hr 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 translate has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                module.exports.translate = (req, res, next) => {
                
                    req.locale = module.exports.defaultLocale;
                
                    let route = req.route || req.path,
                Severity: Minor
                Found in lib/server/init/locale.js - About 1 hr 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

                exports.isDir = function (filePath) {
                    return exports
                        .stats(filePath)
                        .then((stats) => {
                            return (stats && stats.isDirectory());
                Severity: Major
                Found in lib/utils/index.js and 1 other location - About 1 hr to fix
                lib/utils/index.js on lines 327..334

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

                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

                    KnexStore.prototype.set = function (sid, sess, fn) {
                        this
                            .statSession(sid, sess)
                            .then(this._set.bind(this, sid, sess, fn));
                    };
                Severity: Major
                Found in modules/users/server/lib/connect-session-knex/index.js and 1 other location - About 1 hr to fix
                modules/users/server/lib/connect-session-knex/index.js on lines 239..243

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

                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

                class RolePickerUI extends Picker {
                
                    get template() {
                
                        return 'cms/cms/role-picker';
                Severity: Major
                Found in modules/cms/client/js/manager/role.picker.ui.js and 1 other location - About 1 hr to fix
                modules/cms/client/js/manager/block.picker.ui.js on lines 24..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 60.

                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

                exports.exists = function (filePath) {
                    return exports
                        .stats(filePath)
                        .then((stats) => {
                            return (stats && stats.isFile());
                Severity: Major
                Found in lib/utils/index.js and 1 other location - About 1 hr to fix
                lib/utils/index.js on lines 341..348

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

                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

                    KnexStore.prototype.touch = function (sid, sess, fn) {
                        this
                            .statSession(sid, sess)
                            .then(this._touch.bind(this, sid, sess, fn));
                    };
                Severity: Major
                Found in modules/users/server/lib/connect-session-knex/index.js and 1 other location - About 1 hr to fix
                modules/users/server/lib/connect-session-knex/index.js on lines 207..211

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

                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

                class BlockPickerUI extends Picker {
                
                    get template() {
                
                        return 'cms/cms/block-picker';
                Severity: Major
                Found in modules/cms/client/js/manager/block.picker.ui.js and 1 other location - About 1 hr to fix
                modules/cms/client/js/manager/role.picker.ui.js on lines 24..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 60.

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

                            static capture(req, res, next) {
                
                                let route = req.route.toString().replace(/\..*$/, ''),
                                    fullPath = req.protocol + '://' + req.get('host') + route;
                
                
                Severity: Minor
                Found in modules/cms/server/controllers/page.js - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language