studpad/studpad

View on GitHub

Showing 118 of 280 total issues

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

        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

            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

              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

                Function getScoreFunction has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  Sifter.prototype.getScoreFunction = function(search, options) {
                    var self, fields, tokens, token_count;
                
                    self        = this;
                    search      = self.prepareSearch(search, options);
                Severity: Major
                Found in app/assets/javascripts/selectize_fixed.js - About 2 hrs to fix

                  File explore.js has 264 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  /**
                   * cbpGridGallery.js v1.0.0
                   * http://www.codrops.com
                   *
                   * Licensed under the MIT license.
                  Severity: Minor
                  Found in app/assets/stylesheets/explore.js - About 2 hrs to fix

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

                      Tooltip.prototype.show = function () {
                        var e = $.Event('show.bs.' + this.type)
                    
                        if (this.hasContent() && this.enabled) {
                          this.$element.trigger(e)
                    Severity: Major
                    Found in app/assets/javascripts/bootstrap.js - About 2 hrs to fix

                      Function render has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                      Open

                        render: function() {
                          var main_part;
                          files = this.props.post.files.map(function (f, index) {
                            return (
                              <ModalContentFile
                      Severity: Minor
                      Found in app/assets/javascripts/components/post_modal_content.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 a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                      Open

                        render(){
                          post = this.props.post;
                          var image, link_rendered;
                          switch (this.props.post.type) {
                            case PostTypes.link:
                      Severity: Minor
                      Found in app/assets/javascripts/components/explore_post.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 slide has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              var slide = function() {
                                  // add class animatable to the slideshow grid
                                  classie.addClass( self.slideshow, 'animatable' );
                      
                                  // overlays:
                      Severity: Minor
                      Found in app/assets/stylesheets/explore.js - About 1 hr to fix

                        Function setActiveItem has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            setActiveItem: function($item, e) {
                              var self = this;
                              var eventName;
                              var i, idx, begin, end, item, swap;
                              var $last;
                        Severity: Minor
                        Found in app/assets/javascripts/selectize_fixed.js - About 1 hr to fix

                          Function autoGrow has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            var autoGrow = function($input) {
                              var currentWidth = null;
                          
                              var update = function(e, options) {
                                var value, keyCode, printable, placeholder, width;
                          Severity: Minor
                          Found in app/assets/javascripts/selectize_fixed.js - About 1 hr to fix

                            Function render has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              render: function() {
                            
                                var className;
                                if (this.props.className) {
                                  className = this.props.className;
                            Severity: Minor
                            Found in app/assets/javascripts/react-dropzone.js.jsx - About 1 hr to fix

                              Function users_list has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  var users_list = this.state.users.map(function(user){
                                    var button, disabled;
                                    if (user.checked) {
                                      button =(
                                        <button
                              Severity: Minor
                              Found in app/assets/javascripts/components/follow_box.js.jsx - About 1 hr to fix

                                Function deleteSelection has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    deleteSelection: function(e) {
                                      var i, n, direction, selection, values, caret, option_select, $option_select, $tail;
                                      var self = this;
                                
                                      direction = (e && e.keyCode === KEY_BACKSPACE) ? -1 : 1;
                                Severity: Minor
                                Found in app/assets/javascripts/selectize_fixed.js - About 1 hr to fix

                                  Function createPost has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    createPost: function(postData) {
                                      var oldPosts = this.state.posts;
                                      var newPost = [{
                                        id: Date.now(),//random id for first
                                        type: postData.type,
                                  Severity: Minor
                                  Found in app/assets/javascripts/components/post_box.js.jsx - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language