getlackey/lackey-cms

View on GitHub

Showing 527 of 527 total issues

Function parse has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports.parse = (data) => {

    if (!data.taxonomy && !data.taxonomies) {
        return Promise.resolve(null);
    }
Severity: Minor
Found in modules/core/server/models/taxonomy/generator.js - About 1 hr to fix

    Function query has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                static query (query, populate, options) {
                    if (options.taxonomies) {
                        return Promise.all(options.taxonomies.map((taxonomy) => {
                            return TaxonomyType.findOneBy('name', taxonomy.type);
                        })).then((responses) => {
    Severity: Minor
    Found in modules/core/server/models/content/index.js - About 1 hr to fix

      Function _preQuery has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                          static _preQuery(query, options) {
                              let amendedQuery = JSON.parse(JSON.stringify(query || {}));
      
                              if (this.likeables && options && options.textSearch) {
      
      
      Severity: Minor
      Found in modules/core/server/models/objection/index.js - About 1 hr to fix

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

                if (state.src.charCodeAt(oldPos) !== 0x40 /* @ */ ||
                    state.src.charCodeAt(oldPos + 1) !== 0x5B /* [ */ ) {
                    return false;
                }
        Severity: Major
        Found in modules/cms/shared/video/editmode.js and 1 other location - About 1 hr to fix
        modules/cms/shared/video/viewmode.js on lines 52..55

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

        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 2 locations. Consider refactoring.
        Open

            if (state.src.charCodeAt(oldPos) !== 0x40 /* @ */ ||
              state.src.charCodeAt(oldPos + 1) !== 0x5B /* [ */ ) {
              return false;
            }
        Severity: Major
        Found in modules/cms/shared/video/viewmode.js and 1 other location - About 1 hr to fix
        modules/cms/shared/video/editmode.js on lines 28..31

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

        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 (this._doc.email) {
                            promise = promise
                                .then(this
                                    .bind(this._detectConflict, [User.EMAIL, this._doc.email]));
                        }
        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 300..304

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

        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 (this._doc.username) {
                            promise = promise
                                .then(this
                                    .bind(this._detectConflict, [User.USERNAME, this._doc.username]));
                        }
        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 294..298

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

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

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

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

              .then((knex, config) => {
                  return Promise
                      .resolve()
              .then(() => {
                  if (!config.get('datasources.pg.default.truncate')) return null;
          Severity: Minor
          Found in modules/i18n/server/models/language/knex.js - About 1 hr to fix

            Function exports has 28 lines of code (exceeds 25 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

              Function selectFiller has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  selectFiller(data) {
                      var self = this,
                          i,
                          getOptions = (options, column) => {
                              data.forEach((row) => {
              Severity: Minor
              Found in modules/core/client/js/table.js - About 1 hr to fix

                Function remove has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                            remove() {
                                let self = this;
                                return Promise
                                    .all([
                                    SCli.sql(Identities
                Severity: Minor
                Found in modules/core/server/models/user/index.js - About 1 hr to fix

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

                                  return SCli
                                      .sql(this.model
                                          .query()
                                          .where('selectable', true)
                                          .where('type', 'template')
                  Severity: Major
                  Found in modules/core/server/models/template/index.js and 1 other location - About 1 hr to fix
                  modules/core/server/models/template/index.js on lines 163..180

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

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

                  module.exports.viewAs = (req, res, next) => {
                  
                      return SUtils
                          .cmsMod('core')
                          .model('role')
                  Severity: Minor
                  Found in modules/users/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 selectFiller has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      selectFiller(data) {
                          var self = this,
                              i,
                              getOptions = (options, column) => {
                                  data.forEach((row) => {
                  Severity: Minor
                  Found in modules/core/client/js/table.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 merge has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      merge: function () {
                          var args = Array.prototype.slice.apply(arguments),
                              result = args.shift(),
                              i, p, obj;
                          for (i = 0; i < args.length; i++) {
                  Severity: Minor
                  Found in modules/core/client/js/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 renderVideo has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        renderVideo() {
                              if (['video/youtube', 'video/vimeo'].indexOf(this.media.mime) > -1) {
                                    return this.renderImage();
                              }
                              let
                  Severity: Minor
                  Found in modules/cms/client/js/media.js - About 1 hr to fix

                    Function list has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          list() {
                                let self = this,
                                      query = this.search ? this.search.value : null,
                                      url = '/cms/media?limit=4&sort=-createdAt&page=' + self.page;
                    
                    
                    Severity: Minor
                    Found in modules/cms/client/js/manager/media.js - About 1 hr to fix

                      Function ensureUnique has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                                  static ensureUnique(req, res) {
                                      let Content;
                                      SUtils.cmsMod('core').model('content')
                                      .then((content) => {
                                          Content = content;
                      Severity: Minor
                      Found in modules/cms/server/controllers/media.js - About 1 hr to fix

                        Function contents has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                    static contents() {
                                        return Content
                                            .find()
                                            .then((contents) => Promise.all(contents.map((content) => {
                                                let promise;
                        Severity: Minor
                        Found in modules/cms/server/lib/serializer.js - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language