getlackey/lackey-cms

View on GitHub

Showing 527 of 527 total issues

Function pageq has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    pageq(options) {
        var self = this,
            page = this.pageNumber,
            cloneData = this.data.rows.slice(),
            pages,
Severity: Minor
Found in modules/core/client/js/table.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 readModule has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function readModule(name, server) {

    SCli.debug(__MODULE_NAME, 'READ ' + name);

    if (loadedModules[name]) {
Severity: Minor
Found in lib/server/module-loader.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((ObjectionWrapper, User) => {
        SCli.debug(__MODULE_NAME, 'READY');

        class SessionModel extends Model {
            static get tableName() {
Severity: Minor
Found in modules/core/server/models/session/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 stats has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

exports.stats = function (filePath) {
    return new Promise((resolve, reject) => {
        fs.stat(filePath, (err, stats) => {
            if (err) {
                if (err.code === 'ENOENT') {
Severity: Minor
Found in lib/utils/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 moduleInterface has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

exports.moduleInterface = function (modulePath, moduleName) {

    let api = {
        /**
         * Loads module model
Severity: Minor
Found in lib/utils/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

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

                        return roles.map((role) => {
                            return {
                                name: role.name,
                                label: role.label,
                                acl: role.acl
Severity: Minor
Found in modules/cms/server/lib/serializer.js and 1 other location - About 35 mins to fix
modules/cms/server/lib/serializer.js on lines 123..129

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

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

    show: function (selector, root) {
        lackey.each(selector, function (target) {
            target.style.display = 'initial';
        }, root);
    },
Severity: Minor
Found in modules/core/client/js/index.js and 1 other location - About 35 mins to fix
modules/core/client/js/index.js on lines 233..237

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

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

    if (isHTML) {
        req.headers.accept = 'text/html,*/*;q=0.1';
        req.headers['content-type'] = 'text/html';
        res.header('Content-Type', 'text/html');
    } else if (isJSON) {
Severity: Minor
Found in lib/server/init/format.js and 2 other locations - About 35 mins to fix
lib/server/init/format.js on lines 61..72
lib/server/init/format.js on lines 65..72

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

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

    } else if (isYAML) {
        req.headers.accept = 'text/x-yaml,*/*;q=0.1';
        req.headers['content-type'] = 'text/x-yaml';
        res.header('Content-Type', 'text/x-yaml');
    } else if (isXLS) {
Severity: Minor
Found in lib/server/init/format.js and 2 other locations - About 35 mins to fix
lib/server/init/format.js on lines 57..72
lib/server/init/format.js on lines 61..72

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

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

    hide: function (selector, root) {
        lackey.each(selector, function (target) {
            target.style.display = 'none';
        }, root);
    },
Severity: Minor
Found in modules/core/client/js/index.js and 1 other location - About 35 mins to fix
modules/core/client/js/index.js on lines 228..232

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

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

    } else if (isJSON) {
        req.headers.accept = 'application/json,*/*;q=0.1';
        req.headers['content-type'] = 'application/json';
        res.header('Content-Type', 'application/json');
    } else if (isYAML) {
Severity: Minor
Found in lib/server/init/format.js and 2 other locations - About 35 mins to fix
lib/server/init/format.js on lines 57..72
lib/server/init/format.js on lines 65..72

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

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

                    .then((medias) => medias.map((media) => {
                        return {
                            name: media.name,
                            source: media.source,
                            attributes: media.attributes
Severity: Minor
Found in modules/cms/server/lib/serializer.js and 1 other location - About 35 mins to fix
modules/cms/server/lib/serializer.js on lines 64..70

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

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

Avoid too many return statements within this function.
Open

    return true;
Severity: Major
Found in modules/users/client/js/reset-password.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return true;
    Severity: Major
    Found in modules/users/client/js/account.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return true;
      Severity: Major
      Found in modules/cms/client/js/new-user-password.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                            return -1;
        Severity: Major
        Found in modules/core/client/js/table.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                              return 1;
          Severity: Major
          Found in modules/core/client/js/table.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                                    return new Promise((resolve, reject) => {
                                        if (__debug) {
                                            return resolve(__debug);
                                        }
                                        (path.match(/^https/) ? https : http).get(path, (res) => {
            Severity: Major
            Found in modules/core/server/models/media/index.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return SUtils.serialPromise(calls, (call) => call()).then(() => {
                          return data;
                      });
              Severity: Major
              Found in modules/core/server/models/content/serializer.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                    return -1;
                Severity: Major
                Found in modules/core/client/js/table.js - About 30 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language