getlackey/lackey-cms

View on GitHub

Showing 527 of 527 total issues

Function fn has 80 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    let fn = (_path, options, callback) => {

        if (typeof _path === 'string' && _path.indexOf(',') >= 0) {
            /* express is stupid */
            _path = _path.replace(/\.dust$/, '').split(',');
Severity: Major
Found in lib/server/init/views.js - About 3 hrs to fix

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

                media.upload.on('done', function (uploader, data) {
                    if (data && data.length && data[0].data) {
                        media.set(data[0].data);
                        media.notify();
    
    
    Severity: Major
    Found in modules/cms/client/js/new-media.js and 1 other location - About 3 hrs to fix
    modules/cms/client/js/new-media.js on lines 166..176

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

    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

        dragdrop.on('done', function (uploader, data) {
            if (data && data.length && data[0].data) {
                media.set(data[0].data);
                media.notify();
                growl({
    Severity: Major
    Found in modules/cms/client/js/new-media.js and 1 other location - About 3 hrs to fix
    modules/cms/client/js/new-media.js on lines 151..162

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

    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

    CRUDInjectionController has 27 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class CRUDInjectionController {
    
        static get field() {
            throw new Error('You have to override this method');
        }
    Severity: Minor
    Found in modules/core/server/controllers/crud.injection.js - About 3 hrs to fix

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

          return LanguageModel.then((language) => {
              LanguageModel = language;
      
              if (typeof data === 'string') {
                  SCli.debug('lackey/modules/i18n/server/models/language/generator', 'Gets language ' + data + ' by code');
      Severity: Major
      Found in modules/i18n/server/models/language/generator.js and 1 other location - About 3 hrs to fix
      modules/core/server/models/taxonomy-type/generator.js on lines 29..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 98.

      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

          return require('./index')
              .then(type => {
                  TaxonomyType = type;
      
                  if (typeof data === 'string') {
      Severity: Major
      Found in modules/core/server/models/taxonomy-type/generator.js and 1 other location - About 3 hrs to fix
      modules/i18n/server/models/language/generator.js on lines 27..37

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

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

      module.exports = (dust) => {
          dust.helpers.sort = function (chunk, context, bodies, params) {
              params.items.sort(function (a, b) {
                  if (params.by) {
                      return ((a[params.by] < b[params.by]) ? -1 : ((a[params.by] > b[params.by]) ? 1 : 0));
      Severity: Minor
      Found in modules/cms/server/lib/dust/sort.js - About 3 hrs 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 77 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = (dust) => {
      
          function renderParameter(name, chunk, context, bodies, params) {
              if (params && params[name]) {
                  if (typeof params[name] === 'function') {
      Severity: Major
      Found in modules/core/shared/dust/path.js - About 3 hrs to fix

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

                                    if (self._doc.javascripts) {
                                        if (!Array.isArray(self._doc.javascripts)) {
                                            self._doc.javascripts = [self._doc.javascripts];
                                        }
                                        self._doc.javascripts = JSON.stringify(self._doc.javascripts);
        Severity: Major
        Found in modules/core/server/models/template/index.js and 5 other locations - About 3 hrs to fix
        modules/core/server/models/template/index.js on lines 260..265
        modules/core/server/models/template/index.js on lines 266..271
        modules/core/server/models/template/index.js on lines 272..277
        modules/core/server/models/template/index.js on lines 278..283
        modules/core/server/models/template/index.js on lines 284..289

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

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

                                    if (self._doc.expose) {
                                        if (!Array.isArray(self._doc.expose)) {
                                            self._doc.expose = [self._doc.expose];
                                        }
                                        self._doc.expose = JSON.stringify(self._doc.expose);
        Severity: Major
        Found in modules/core/server/models/template/index.js and 5 other locations - About 3 hrs to fix
        modules/core/server/models/template/index.js on lines 254..259
        modules/core/server/models/template/index.js on lines 260..265
        modules/core/server/models/template/index.js on lines 266..271
        modules/core/server/models/template/index.js on lines 278..283
        modules/core/server/models/template/index.js on lines 284..289

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

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

                                    if (self._doc.variants) {
                                        if (!Array.isArray(self._doc.variants)) {
                                            self._doc.variants = [self._doc.variants];
                                        }
                                        self._doc.variants = JSON.stringify(self._doc.variants);
        Severity: Major
        Found in modules/core/server/models/template/index.js and 5 other locations - About 3 hrs to fix
        modules/core/server/models/template/index.js on lines 254..259
        modules/core/server/models/template/index.js on lines 260..265
        modules/core/server/models/template/index.js on lines 266..271
        modules/core/server/models/template/index.js on lines 272..277
        modules/core/server/models/template/index.js on lines 284..289

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

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

                                    if (self._doc.populate) {
                                        if (!Array.isArray(self._doc.populate)) {
                                            self._doc.populate = [self._doc.populate];
                                        }
                                        self._doc.populate = JSON.stringify(self._doc.populate);
        Severity: Major
        Found in modules/core/server/models/template/index.js and 5 other locations - About 3 hrs to fix
        modules/core/server/models/template/index.js on lines 254..259
        modules/core/server/models/template/index.js on lines 260..265
        modules/core/server/models/template/index.js on lines 272..277
        modules/core/server/models/template/index.js on lines 278..283
        modules/core/server/models/template/index.js on lines 284..289

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

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

                                    if (self._doc.require) {
                                        if (!Array.isArray(self._doc.require)) {
                                            self._doc.require = [self._doc.require];
                                        }
                                        self._doc.require = JSON.stringify(self._doc.require);
        Severity: Major
        Found in modules/core/server/models/template/index.js and 5 other locations - About 3 hrs to fix
        modules/core/server/models/template/index.js on lines 254..259
        modules/core/server/models/template/index.js on lines 260..265
        modules/core/server/models/template/index.js on lines 266..271
        modules/core/server/models/template/index.js on lines 272..277
        modules/core/server/models/template/index.js on lines 278..283

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

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

                                    if (self._doc.stylesheets) {
                                        if (!Array.isArray(self._doc.stylesheets)) {
                                            self._doc.stylesheets = [self._doc.stylesheets];
                                        }
                                        self._doc.stylesheets = JSON.stringify(self._doc.stylesheets);
        Severity: Major
        Found in modules/core/server/models/template/index.js and 5 other locations - About 3 hrs to fix
        modules/core/server/models/template/index.js on lines 254..259
        modules/core/server/models/template/index.js on lines 266..271
        modules/core/server/models/template/index.js on lines 272..277
        modules/core/server/models/template/index.js on lines 278..283
        modules/core/server/models/template/index.js on lines 284..289

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

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

            res.send = (data, forceFormat) => {
        
                res.send = lSend;
                let output = {};
                output = _.merge(data);
        Severity: Major
        Found in lib/server/init/format.js - About 3 hrs to fix

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

          module.exports = (server) => {
          
              return SUtils
                  .waitForAs('cms routes',
                      require('../controllers'),
          Severity: Major
          Found in modules/cms/server/routes/cms.routes.js - About 2 hrs to fix

            Function ModalController has 73 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function ModalController(rootNode, vars, resolve) {
            
                  let dummy,
                        result = vars.media,
                        repository;
            Severity: Major
            Found in modules/cms/client/js/manager/media.js - About 2 hrs to fix

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

                  .then((ObjectionWrapper) => {
              
                      class LanguageModel extends Model {
                          static get tableName() {
                              return 'language';
              Severity: Major
              Found in modules/i18n/server/models/language/index.js - About 2 hrs to fix

                Function rest has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                module.exports.rest = (req, res, next) => {
                
                    req.getRESTQuery = (truncate) => {
                
                        let result = {
                Severity: Minor
                Found in lib/server/init/rest.js - About 2 hrs 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 21 (exceeds 5 allowed). Consider refactoring.
                Open

                module.exports = (dust) => {
                  dust.filters.media = function (value) {
                      var returnString = '';
                      if (value.mime === 'video/youtube') {
                          returnString += '<iframe type="text/html" src="https://www.youtube.com/embed/' + isYoutube(value.source) + '" frameborder="0"></iframe>';
                Severity: Minor
                Found in modules/core/shared/dust/media.js - About 2 hrs 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