getlackey/lackey-cms

View on GitHub

Showing 527 of 527 total issues

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

  function renderBlock(block, chunk, context) {
    var output = '';
    chunk.tap(function (data) {
      output += data;
      return '';
Severity: Major
Found in modules/cms/server/lib/dust/base.js and 2 other locations - About 1 hr to fix
modules/analytics/server/lib/dust/filter.js on lines 28..35
modules/cms/server/lib/dust/translate.js on lines 26..33

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

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 renderBlock(block, chunk, context) {
        var output = '';
        chunk.tap(function (data) {
            output += data;
            return '';
Severity: Major
Found in modules/analytics/server/lib/dust/filter.js and 2 other locations - About 1 hr to fix
modules/cms/server/lib/dust/base.js on lines 22..29
modules/cms/server/lib/dust/translate.js on lines 26..33

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

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

            toJSON() {
                return {
                    id: this._doc.id,
                    metric: this._doc.metric,
                    date: this._doc.date,
Severity: Major
Found in modules/core/server/models/analytics/index.js and 1 other location - About 1 hr to fix
modules/core/server/models/translation/index.js on lines 91..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 64.

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

            toJSON() {
                return {
                    id: this._doc.id,
                    origionalContent: this._doc.origionalContent,
                    language: this._doc.language,
Severity: Major
Found in modules/core/server/models/translation/index.js and 1 other location - About 1 hr to fix
modules/core/server/models/analytics/index.js on lines 148..155

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

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 (cached.username) {
                    promise = promise.then(
                        (user) => {
                            return user
                                .setIdentity(User.USERNAME, cached.username, null, null, null, cached.confirmed === true);
Severity: Major
Found in modules/core/server/models/user/index.js and 1 other location - About 1 hr to fix
modules/core/server/models/user/index.js on lines 406..412

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

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 (cached.email) {
                    promise = promise
                        .then((user) => {
                            return user
                                .setIdentity(User.EMAIL, cached.email, null, null, null, cached.confirmed === true);
Severity: Major
Found in modules/core/server/models/user/index.js and 1 other location - About 1 hr to fix
modules/core/server/models/user/index.js on lines 413..419

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

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

            static _mapTaxonomyList(list, req, page) {
                return Promise.all(list.map(taxonomy => {
                        if (taxonomy.ifNot) {
                            if (PageController.parse(taxonomy.ifNot, req, page)) {
                                return null;
Severity: Minor
Found in modules/cms/server/controllers/page.js - About 1 hr to fix

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

    module.exports = (dust) => {
    
        dust.helpers.list = function (chunk, context, bodies, params) {
            SCli.debug('lackey-cms/modules/cms/server/lib/dust/block');
    
    
    Severity: Minor
    Found in modules/cms/server/lib/dust/list.js - About 1 hr to fix

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

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

        Function showTab has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Manager.prototype.showTab = function (tab, callback) {
            lackey.hook('header.settings').setAttribute('disabled', 'disabled');
        
            let self = this,
                structureController,
        Severity: Minor
        Found in modules/cms/client/js/manager/index.js - About 1 hr to fix

          Function generateAbstractOutline has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              static generateAbstractOutline(block, bounds) {
                  var allElements = [],
                      outlines = [];
          
                  block.elements.forEach(element => {
          Severity: Minor
          Found in modules/cms/client/js/block-editor.js - About 1 hr to fix

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

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

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

                    constructor(HTMLElement, noInput) {
              
                          this._listeners = [];
                          this.node = HTMLElement;
                          this.attributes = {};
              Severity: Minor
              Found in modules/cms/client/js/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 exports has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  .then((User, ObjectionWrapper) => {
              
                      SCli.debug(__MODULE_NAME, 'READY');
              
                      class ActivityLogModel extends Model {
              Severity: Minor
              Found in modules/core/server/models/activity-log/index.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 context has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

              module.exports.context = (options, lackeyPath, projectPath, referredPath) => {
              
                  try {
              
                      let root = projectPath,
              Severity: Minor
              Found in lib/server/init/views.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 _normalizeAbstract has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  static _normalizeAbstract(layout) {
                      var minX = Infinity,
                          maxX = -Infinity,
                          minY = Infinity,
                          scale = 1,
              Severity: Minor
              Found in modules/cms/client/js/block-editor.js - About 1 hr to fix

                Function mapActions has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    static mapActions(actions, columns, rows, rowAction) {
                        let
                            self = this;
                        if (rows) {
                            rows.forEach((row) => {
                Severity: Minor
                Found in modules/core/server/controllers/crud.injection.js - About 1 hr to fix

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

                  module.exports.encode = function (value, salt) {
                      let cipher = crypto
                          .createCipher(algorithm, salt);
                      return cipher.update(value, 'utf8', 'hex') + cipher.final('hex');
                  };
                  Severity: Major
                  Found in modules/analytics/server/lib/dust/filter.js and 1 other location - About 1 hr to fix
                  modules/analytics/server/lib/dust/filter.js on lines 59..62

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

                  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

                              static findById(id) {
                                  SCli.debug(__MODULE_NAME, 'findById', this.model.tableName, id);
                                  if (!id) {
                                      return Promise.resolve(null);
                                  }
                  Severity: Major
                  Found in modules/core/server/models/session/index.js and 1 other location - About 1 hr to fix
                  modules/core/server/models/translation/index.js on lines 57..63

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

                  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

                              static findById(id) {
                                  SCli.debug(__MODULE_NAME, 'findById', this.model.tableName, id);
                                  if (!id) {
                                      return Promise.resolve(null);
                                  }
                  Severity: Major
                  Found in modules/core/server/models/translation/index.js and 1 other location - About 1 hr to fix
                  modules/core/server/models/session/index.js on lines 58..64

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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language