Laverna/laverna

View on GitHub

Showing 111 of 111 total issues

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

        checkChanges: function() {
            var promises = [],
                self     = this;

            this.configs.statRemote = false;
Severity: Minor
Found in app/scripts/modules/dropbox/classes/sync.js - About 1 hr to fix

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

    define([
        'marionette'
    ], function(Marionette) {
        'use strict';
    
    
    Severity: Major
    Found in app/scripts/apps/notes/form/behaviors/mobile.js and 1 other location - About 1 hr to fix
    app/scripts/apps/notes/form/behaviors/desktop.js on lines 9..21

    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

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

            onDestroy: function() {
                if (this.options.callback) {
                    this.options.callback(null);
                }
    
    
    Severity: Major
    Found in app/scripts/modules/linkDialog/controller.js and 1 other location - About 1 hr to fix
    app/scripts/modules/fileDialog/controller.js on lines 48..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 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

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

            onDestroy: function() {
                if (this.options.callback) {
                    this.options.callback(null);
                }
    
    
    Severity: Major
    Found in app/scripts/modules/fileDialog/controller.js and 1 other location - About 1 hr to fix
    app/scripts/modules/linkDialog/controller.js on lines 45..52

    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

    define([
        'marionette'
    ], function(Marionette) {
        'use strict';
    
    
    Severity: Major
    Found in app/scripts/apps/notes/form/behaviors/desktop.js and 1 other location - About 1 hr to fix
    app/scripts/apps/notes/form/behaviors/mobile.js on lines 9..21

    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

    Function initEncrypt has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            initEncrypt: function() {
                var promises = [],
                    profile  = (this.profiles.length === 1 ? this.profiles[0] : 'notes-db'),
                    self     = this;
    
    
    Severity: Minor
    Found in app/scripts/apps/encryption/encrypt/controller.js - About 1 hr to fix

      Function show has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              show: function(note, notebooks) {
                  var notebooksView;
                  note = note[0];
      
                  // Set document title
      Severity: Minor
      Found in app/scripts/apps/notes/form/controller.js - About 1 hr to fix

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

                        return self.save(model, {trash: 0, updated: Date.now()})
                        .then(function(model) {
                            self.vent.trigger('restore:model', model);
                            return model;
                        });
        Severity: Major
        Found in app/scripts/collections/modules/notes.js and 1 other location - About 1 hr to fix
        app/scripts/collections/modules/notes.js on lines 84..88

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

        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 self.save(model, {trash: 1, updated: Date.now()})
                        .then(function(model) {
                            self.vent.trigger('destroy:model', model);
                            return model;
                        });
        Severity: Major
        Found in app/scripts/collections/modules/notes.js and 1 other location - About 1 hr to fix
        app/scripts/collections/modules/notes.js on lines 103..107

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

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

                saveForageItem: function(storeName, db, data) {
                    var defer  = Q.defer();
        
                    // Convert data
                    if (!_.isUndefined(data.notebookId)) {
        Severity: Minor
        Found in app/scripts/helpers/migrate.js - About 1 hr to fix

          Function onScroll has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  onScroll: _.debounce(function(e) {
          
                      // Don't do any computations
                      if (!e.doc.scrollTop) {
                          this.view.ui.previewScroll.scrollTop(0);
          Severity: Minor
          Found in app/scripts/modules/codemirror/controller.js - About 1 hr to fix

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

                    setEscape: function(data) {
                        if (data.name) {
                            data.name = _.cleanXSS(data.name, true);
                        }
            
            
            Severity: Major
            Found in app/scripts/models/file.js and 2 other locations - About 1 hr to fix
            app/scripts/models/notebook.js on lines 59..66
            app/scripts/models/tag.js on lines 37..44

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

            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

                    setEscape: function(data) {
                        if (data.name) {
                            data.name = _.cleanXSS(data.name, true);
                        }
            
            
            Severity: Major
            Found in app/scripts/models/tag.js and 2 other locations - About 1 hr to fix
            app/scripts/models/file.js on lines 50..57
            app/scripts/models/notebook.js on lines 59..66

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

            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

                    setEscape: function(data) {
                        if (data.name) {
                            data.name = _.cleanXSS(data.name, true);
                        }
            
            
            Severity: Major
            Found in app/scripts/models/notebook.js and 2 other locations - About 1 hr to fix
            app/scripts/models/file.js on lines 50..57
            app/scripts/models/tag.js on lines 37..44

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

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

                    toggleBlock: function(type) {
                        var stat  = this.getState(),
                            start = this.editor.getCursor('start'),
                            end   = this.editor.getCursor('end'),
                            text,
            Severity: Minor
            Found in app/scripts/modules/codemirror/controller.js - About 1 hr to fix

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

                      bind: function() {
                          var self = this;
              
                          // Help
                          Mousetrap.bind(this.configs.appKeyboardHelp, function(e) {
              Severity: Minor
              Found in app/scripts/helpers/keybindings.js - About 1 hr to fix

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

                        getModel: function(options) {
                            var Model  = (this.changeDatabase(options)).prototype.model,
                                idAttr = Model.prototype.idAttribute,
                                data   = {},
                                model;
                Severity: Minor
                Found in app/scripts/collections/modules/module.js - About 1 hr to fix

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

                          modelFocus: _.debounce(function(model) {
                              this.view.options.activeModel = model.id;
                              model.trigger('focus');
                          }, 10),
                  app/scripts/apps/notes/list/views/noteSidebar.js on lines 92..95

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

                  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

                          modelFocus: _.debounce(function(model) {
                              this.options.args.id = model.id;
                              model.trigger('focus');
                          }, 10),
                  Severity: Major
                  Found in app/scripts/apps/notes/list/views/noteSidebar.js and 1 other location - About 1 hr to fix
                  app/scripts/apps/notebooks/list/behaviors/compositeBehavior.js on lines 73..76

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

                  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

                      LinkDialog.on('before:start', function(options) {
                          LinkDialog.controller = new Controller(options);
                  
                          this.listenTo(LinkDialog.controller, 'destroy', LinkDialog.stop);
                      });
                  Severity: Major
                  Found in app/scripts/modules/linkDialog/module.js and 1 other location - About 1 hr to fix
                  app/scripts/modules/fileDialog/module.js on lines 44..47

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

                  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