getlackey/lackey-cms

View on GitHub

Showing 527 of 527 total issues

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

Repository.prototype.saveAll = function () {
    let self = this;
    return Promise.all(Object.keys(this._copy).map((key) => self.save(key)));
};
Severity: Major
Found in modules/cms/client/js/manager/repository.js and 1 other location - About 1 hr to fix
modules/cms/client/js/manager/repository.js on lines 199..202

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

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

    function video_return(state, silent) {
        var serviceEnd,
            serviceStart,
            token,
            oldPos = state.pos;
Severity: Minor
Found in modules/cms/shared/video/editmode.js - About 1 hr to fix

    Function preview has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Manager.prototype.preview = function (variant, language) {
        let self = this;
        this
            .current
            .then(def => self.repository.get('content', def.id))
    Severity: Minor
    Found in modules/cms/client/js/manager/index.js - About 1 hr to fix

      Function addFile has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function addFile (progressContainer, data) {
          var fileDiv = document.createElement('div'),
              fileFigure = document.createElement('figure'),
              fileImg = document.createElement('img'),
              fileTitle = document.createElement('p'),
      Severity: Minor
      Found in modules/cms/client/js/new-media.js - About 1 hr to fix

        Function jsonSchema has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    static get jsonSchema() {
                        return {
                            type: 'object',
                            required: ['type', 'route'],
                            properties: {
        Severity: Minor
        Found in modules/core/server/models/content/index.js - About 1 hr to fix

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

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

                gulp.task('lackey.server', function () {
                    return nodemon({
                        script: lackeyDIR + '/lib/server/start.js',
                        exec: 'node --harmony',
                        ext: 'js yaml json',
            Severity: Major
            Found in gulp/index.js and 1 other location - About 1 hr to fix
            gulp/index.js on lines 78..91

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

            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

                gulp.task('lackey.server.dev', function () {
                    return nodemon({
                        script: lackeyDIR + '/lib/server/start.js',
                        exec: 'node --harmony --debug',
                        ext: 'js yaml json',
            Severity: Major
            Found in gulp/index.js and 1 other location - About 1 hr to fix
            gulp/index.js on lines 93..106

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

            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 constructor has 42 lines of code (exceeds 25 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

              Function inspect has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  inspect(path, templatePath) {
                      let
                          structureController,
                          context,
                          data,
              Severity: Minor
              Found in modules/cms/client/js/manager/structure.ui.js - About 1 hr to fix

                Function _set has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    KnexStore.prototype._set = function (sid, sess, fn) {
                
                        var self = this;
                        var maxAge = sess.cookie.maxAge;
                        var now = new Date().getTime();
                Severity: Minor
                Found in modules/users/server/lib/connect-session-knex/index.js - About 1 hr to fix

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

                      .then(ObjectionWrapper => {
                  
                          class Flyweight extends ObjectionWrapper {
                  
                              static flightWeightPreload(force) {
                  Severity: Minor
                  Found in modules/core/server/models/flyweight/index.js - About 1 hr to fix

                    Function createElement has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    Growl.prototype.createElement = function () {
                        var self = this,
                            element = document.createElement('figure'),
                            opts = {};
                    
                    
                    Severity: Minor
                    Found in modules/core/client/js/es5/growl.js - About 1 hr to fix

                      Function _postSave has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                                  _postSave(cached) {
                      
                                      SCli.debug(__MODULE_NAME, '_postSave');
                      
                                      let promise = super._postSave(cached),
                      Severity: Minor
                      Found in modules/core/server/models/user/index.js - About 1 hr to fix

                        Function toHTML has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                toHTML(markdown, parentTag, editMode) {
                        
                                    let marked = new MarkdownIt({
                                        html: true
                                    });
                        Severity: Minor
                        Found in modules/cms/shared/markdown.js - About 1 hr to fix

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

                          module.exports = (dust) => {
                          
                              function format(value, pattern, utc) {
                                  if (value instanceof Date) {
                                      return dateformat(value, pattern, utc);
                          Severity: Minor
                          Found in modules/core/shared/dust/dateTimeFormat.js - About 1 hr to fix

                            Function where has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                                static where(cursor, query, operand) {
                                                    SCli.debug(__MODULE_NAME, 'where', this.model.tableName, JSON.stringify(query), operand);
                            
                                                    let self = this,
                                                        fn = operand === 'or' ? 'orWhere' : 'where',
                            Severity: Minor
                            Found in modules/core/server/models/objection/index.js - About 1 hr to fix

                              Function toYAML has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                          toYAML() {
                                              let self = this;
                                              return Content.serializer
                                                  .serialize(self.toJSON())
                                                  .then((content) => {
                              Severity: Minor
                              Found in modules/core/server/models/content/index.js - About 1 hr to fix

                                Function create has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    static create(User, config, mailer, req, res) {
                                        var create = {},
                                            user;
                                        create.name = req.body.name;
                                        create.email = req.body.email;
                                Severity: Minor
                                Found in modules/cms/server/controllers/user.js - About 1 hr to fix

                                  Function drawMeta has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      drawMeta() {
                                          let self = this;
                                  
                                          return this.options
                                              .context()
                                  Severity: Minor
                                  Found in modules/cms/client/js/manager/structure.ui.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language