getlackey/lackey-cms

View on GitHub

Showing 527 of 527 total issues

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

            toJSON() {
                return {
                    name: this.name,
                    label: this.label,
                    acl: this.acl,
Severity: Minor
Found in modules/core/server/models/role/index.js and 1 other location - About 40 mins to fix
modules/cms/client/js/emitter.js on lines 88..95

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

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

Stack.prototype.pickUser = function (userId) {
    return this
        .pick(new UserPricker({
            route: userId,
            stack: this
Severity: Minor
Found in modules/cms/client/js/manager/stack.js and 1 other location - About 40 mins to fix
modules/cms/client/js/manager/stack.js on lines 138..144

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

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

    on404: (req, res) => {
        res.status(404);
        res.print(['~/core/404', 'cms/core/404'], {
            path: req.path
        });
Severity: Minor
Found in modules/core/server/controllers/errors.js and 2 other locations - About 40 mins to fix
modules/core/server/controllers/errors.js on lines 27..34
modules/core/server/controllers/errors.js on lines 35..42

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

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(__MODULE_NAME,
        SUtils.cmsMod('core').model('user'),
        SUtils.cmsMod('core').model('session')
    )
    .then((User, Session) => {
Severity: Minor
Found in modules/users/server/controllers/account.js and 2 other locations - About 40 mins to fix
modules/core/server/models/taggable/index.js on lines 30..194
modules/core/server/models/taxonomy-type/index.js on lines 30..98

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

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 renderParameter has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

function renderParameter(name, chunk, context, bodies, params) {
Severity: Minor
Found in modules/cms/server/lib/dust/editable.js - About 35 mins to fix

    Function renderParameter has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        function renderParameter(name, chunk, context, bodies, params) {
    Severity: Minor
    Found in modules/core/shared/dust/path.js - About 35 mins to fix

      Function send has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function send(from, to, subject, text, html) {
      Severity: Minor
      Found in lib/mailer/index.js - About 35 mins to fix

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

            SUtils
                .cmsMod('core')
                .model('user')
                .then((user) => {
                    return user.findById(id);
        Severity: Minor
        Found in modules/users/server/auth/index.js and 2 other locations - About 35 mins to fix
        modules/core/server/models/user/index.js on lines 321..330
        modules/core/server/models/user/index.js on lines 367..377

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

        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

                            return SUtils
                                .cmsMod('core')
                                .model('media')
                                .then((Media) => {
                                    return Media.generator(image);
        Severity: Minor
        Found in modules/core/server/models/user/index.js and 2 other locations - About 35 mins to fix
        modules/core/server/models/user/index.js on lines 321..330
        modules/users/server/auth/index.js on lines 28..38

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

        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

                        return SUtils
                            .cmsMod('core')
                            .model('media')
                            .then((Media) => {
                                return Media.generator(imagePath);
        Severity: Minor
        Found in modules/core/server/models/user/index.js and 2 other locations - About 35 mins to fix
        modules/core/server/models/user/index.js on lines 367..377
        modules/users/server/auth/index.js on lines 28..38

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

        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 pattern has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        module.exports.pattern = (variant, state, locale) => {
            if (!variant && !state && !locale) {
                return '*';
            }
        
        
        Severity: Minor
        Found in modules/cms/shared/treeparser.js - About 35 mins 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 crawl has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        function crawl(thing) {
            var p = [];
            if (isObject(thing)) {
                if (thing.type && thing.type === 'Media') {
                    return Promise.resolve(thing.id);
        Severity: Minor
        Found in modules/cms/server/controllers/media.js - About 35 mins 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 7 (exceeds 5 allowed). Consider refactoring.
        Open

        module.exports = (dust) => {
        
          dust.helpers.attr = function (chunk, context, bodies, params) {
            let
              content = params.content,
        Severity: Minor
        Found in modules/cms/server/lib/dust/attr.js - About 35 mins 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 7 (exceeds 5 allowed). Consider refactoring.
        Open

        module.exports = function (basePath, origPathName, givePrefix, addon) {
            var
                pathPrefix = basePath.replace(/.+?:\/\/.+?\/(.*)$/, '$1'),
                cleanPrefix = (pathPrefix && pathPrefix.length) ? (pathPrefix.replace(/([^\/]{1})\/$/, '$1')) : pathPrefix,
                pathName = origPathName.replace(/([^\/]{1})\/$/, '$1'),
        Severity: Minor
        Found in modules/cms/client/js/iframe.resolve.js - About 35 mins 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 7 (exceeds 5 allowed). Consider refactoring.
        Open

            .then((User, Session) => {
                return {
                    index: (req, res) => {
        
                        let data = {};
        Severity: Minor
        Found in modules/users/server/controllers/account.js - About 35 mins 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 _loadCurrent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        Manager.prototype._loadCurrent = function () {
        
            let
                loc = top.location.pathname,
                self = this;
        Severity: Minor
        Found in modules/cms/client/js/manager/index.js - About 35 mins 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 getComments has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            static getComments(root) {
                var foundComments = [];
                var elementPath = [root];
        
                while (elementPath.length > 0) {
        Severity: Minor
        Found in modules/cms/client/js/block-editor.js - About 35 mins 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 crawl has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        function crawl(data) {
            SCli.debug(MODULE_NAME, 'crawl');
            if (!data) {
                return Promise.resolve(data);
            }
        Severity: Minor
        Found in modules/core/server/models/content/serializer.js - About 35 mins 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 7 (exceeds 5 allowed). Consider refactoring.
        Open

        module.exports = (dust) => {
        
            dust.helpers.iterate = function (chunk, context, bodies, params) {
        
                let from = params.from || 0,
        Severity: Minor
        Found in modules/core/shared/dust/iterate.js - About 35 mins 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 7 (exceeds 5 allowed). Consider refactoring.
        Open

        module.exports = (data) => {
        
            return require('./index')
                .then((Role) => {
        
        
        Severity: Minor
        Found in modules/core/server/models/role/generator.js - About 35 mins 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

        Severity
        Category
        Status
        Source
        Language