studpad/studpad

View on GitHub

Showing 280 of 280 total issues

Function _navigate has 78 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    CBPGridGallery.prototype._navigate = function( dir ) {
        if( this.isAnimating ) return;
        if( dir === 'next' && this.current === this.itemsCount - 1 ||  dir === 'prev' && this.current === 0  ) {
            this._closeSlideshow();
            return;
Severity: Major
Found in app/assets/stylesheets/explore.js - About 3 hrs to fix

    Function onKeyDown has 76 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        onKeyDown: function(e) {
          var isInput = e.target === this.$control_input[0];
          var self = this;
    
          if (self.isLocked) {
    Severity: Major
    Found in app/assets/javascripts/selectize_fixed.js - About 3 hrs to fix

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

          if (self.settings.options) {
            for (i = 0, n = self.settings.options.length; i < n; i++) {
              self.registerOption(self.settings.options[i]);
            }
            delete self.settings.options;
      Severity: Major
      Found in app/assets/javascripts/selectize_fixed.js and 1 other location - About 3 hrs to fix
      app/assets/javascripts/selectize_fixed.js on lines 1121..1126

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

      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 (self.settings.optgroups) {
            for (i = 0, n = self.settings.optgroups.length; i < n; i++) {
              self.registerOptionGroup(self.settings.optgroups[i]);
            }
            delete self.settings.optgroups;
      Severity: Major
      Found in app/assets/javascripts/selectize_fixed.js and 1 other location - About 3 hrs to fix
      app/assets/javascripts/selectize_fixed.js on lines 1113..1118

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

      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

      File react-dropzone.js.jsx has 288 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      //FUNCTION FOR ACCEPT FILES BEGIN
      var accept = function(file, acceptedFiles) {
        if (acceptedFiles) {
          const acceptedFilesArray = acceptedFiles.split(',');
          const mimeType = file.type;
      Severity: Minor
      Found in app/assets/javascripts/react-dropzone.js.jsx - About 2 hrs to fix

        File post_modal_content.js.jsx has 276 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        const PostModalContent = React.createClass({
          //BEGIN***************************************************DECLARE
          propTypes: {
            onChangeLink: React.PropTypes.func.isRequired,
            addAttachment: React.PropTypes.func.isRequired,
        Severity: Minor
        Found in app/assets/javascripts/components/post_modal_content.js.jsx - About 2 hrs to fix

          Function getSortFunction has 65 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            Sifter.prototype.getSortFunction = function(search, options) {
              var i, n, self, field, fields, fields_count, multiplier, multipliers, get_field, implicit_score, sort;
          
              self   = this;
              search = self.prepareSearch(search, options);
          Severity: Major
          Found in app/assets/javascripts/selectize_fixed.js - About 2 hrs to fix

            Function Selectize has 65 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              var Selectize = function($input, settings) {
                var key, i, n, dir, input, self = this;
                input = $input[0];
                input.selectize = self;
            
            
            Severity: Major
            Found in app/assets/javascripts/selectize_fixed.js - About 2 hrs to fix

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

                  var docElem = window.document.documentElement,
                      transEndEventNames = {
                          'WebkitTransition': 'webkitTransitionEnd',
                          'MozTransition': 'transitionend',
                          'OTransition': 'oTransitionEnd',
              Severity: Major
              Found in public/js/cbpGridGallery.js and 1 other location - About 2 hrs to fix
              app/assets/stylesheets/explore.js on lines 15..27

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

              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

                  var docElem = window.document.documentElement,
                      transEndEventNames = {
                          'WebkitTransition': 'webkitTransitionEnd',
                          'MozTransition': 'transitionend',
                          'OTransition': 'oTransitionEnd',
              Severity: Major
              Found in app/assets/stylesheets/explore.js and 1 other location - About 2 hrs to fix
              public/js/cbpGridGallery.js on lines 15..27

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

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

                validate: function(postData){
                  if (postData.type == PostTypes.quotation && !postData.title.trim() )
                    return false;
                  if (postData.type == PostTypes.photo && !postData.photos.length )
                    return false;
              Severity: Minor
              Found in app/assets/javascripts/components/post_modal_form.js.jsx - 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 render has 63 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                render: function() {
                  var likes_count = this.props.likes;
                  var baskets_count = this.props.baskets_count;
                  var classname, classname_img;
                  var like_image_path, basket_image_path;
              Severity: Major
              Found in app/assets/javascripts/components/post_comment_box.js.jsx - About 2 hrs to fix

                PostModalForm has 23 functions (exceeds 20 allowed). Consider refactoring.
                Open

                const PostModalForm = React.createClass({
                  //BEGIN***************************************************DECLARE
                  propTypes: {
                    createPost: React.PropTypes.func.isRequired,
                    updatePost: React.PropTypes.func.isRequired
                Severity: Minor
                Found in app/assets/javascripts/components/post_modal_form.js.jsx - About 2 hrs to fix

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

                      if (post.current_like) {
                        rendered_likes = (
                          <span onClick={this.onLikeClick}>
                            <img
                              title='Лайк'
                  Severity: Major
                  Found in app/assets/javascripts/components/explore_post.js.jsx and 1 other location - About 2 hrs to fix
                  app/assets/javascripts/components/explore_post.js.jsx on lines 63..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 85.

                  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

                      } else {
                        rendered_likes = (
                          <span onClick={this.onLikeClick}>
                            <img
                              title='Лайк'
                  Severity: Major
                  Found in app/assets/javascripts/components/explore_post.js.jsx and 1 other location - About 2 hrs to fix
                  app/assets/javascripts/components/explore_post.js.jsx on lines 50..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 85.

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

                      var init_select = function($input, settings_element) {
                        var i, n, tagName, $children, order = 0;
                        var options = settings_element.options;
                        var optionsMap = {};
                  
                  
                  Severity: Major
                  Found in app/assets/javascripts/selectize_fixed.js - About 2 hrs to fix

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

                    (function(root, factory) {
                      if (typeof define === 'function' && define.amd) {
                        define('sifter', factory);
                      } else if (typeof exports === 'object') {
                        module.exports = factory();
                    Severity: Major
                    Found in app/assets/javascripts/selectize_fixed.js and 1 other location - About 2 hrs to fix
                    app/assets/javascripts/selectize_fixed.js on lines 490..608

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

                    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

                    (function(root, factory) {
                      if (typeof define === 'function' && define.amd) {
                        define('microplugin', factory);
                      } else if (typeof exports === 'object') {
                        module.exports = factory();
                    Severity: Major
                    Found in app/assets/javascripts/selectize_fixed.js and 1 other location - About 2 hrs to fix
                    app/assets/javascripts/selectize_fixed.js on lines 17..470

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

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

                      MicroPlugin.mixin = function(Interface) {
                        Interface.plugins = {};
                    
                        /**
                         * Initializes the listed plugins (with options).
                    Severity: Major
                    Found in app/assets/javascripts/selectize_fixed.js - About 2 hrs to fix

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

                          self.lock = (function() {
                            var original = self.lock;
                            return function() {
                              var sortable = self.$control.data('sortable');
                              if (sortable) sortable.disable();
                      Severity: Major
                      Found in app/assets/javascripts/selectize_fixed.js and 1 other location - About 2 hrs to fix
                      app/assets/javascripts/selectize_fixed.js on lines 3425..3432

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

                      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