studpad/studpad

View on GitHub

Showing 118 of 280 total issues

Function onDrop has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  onDrop: function(e) {
    e.preventDefault();

    this.setState({
      isDragActive: false,
Severity: Minor
Found in app/assets/javascripts/react-dropzone.js.jsx - About 1 hr 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 onDrop has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  onDrop: function(e) {
    e.preventDefault();

    this.setState({
      isDragActive: false,
Severity: Minor
Found in app/assets/javascripts/react-dropzone.js.jsx - About 1 hr 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 onBlur has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    onBlur: function(e, dest) {
      var self = this;
      if (!self.isFocused) return;
      self.isFocused = false;

Severity: Minor
Found in app/assets/javascripts/selectize_fixed.js - About 1 hr to fix

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

      var highlight = function($element, pattern) {
        if (typeof pattern === 'string' && !pattern.length) return;
        var regex = (typeof pattern === 'string') ? new RegExp(pattern, 'i') : pattern;
    
        var highlight = function(node) {
    Severity: Minor
    Found in app/assets/javascripts/selectize_fixed.js - About 1 hr to fix

      Function validate has 26 lines of code (exceeds 25 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 1 hr to fix

        Function refresh has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          ScrollSpy.prototype.refresh = function () {
            var that          = this
            var offsetMethod  = 'offset'
            var offsetBase    = 0
        
        
        Severity: Minor
        Found in app/assets/javascripts/bootstrap.js - About 1 hr to fix

          Function next has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function next() {
                $active
                  .removeClass('active')
                  .find('> .dropdown-menu > .active')
                    .removeClass('active')
          Severity: Minor
          Found in app/assets/javascripts/bootstrap.js - About 1 hr to fix

            Function search has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              Sifter.prototype.search = function(query, options) {
                var self = this, value, score, search, calculateScore;
                var fn_sort;
                var fn_score;
            
            
            Severity: Minor
            Found in app/assets/javascripts/selectize_fixed.js - About 1 hr to fix

              Function likePost has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                likePost: function(id) {
                  var posts = this.state.posts;
                  var likedPost = $.grep(posts, function(e){ return e.id == id; });
                  likedPost = likedPost[0];
                  CI('PostBox::likePost', id);
              Severity: Minor
              Found in app/assets/javascripts/components/post_box.js.jsx - About 1 hr to fix

                Function onDrop has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  onDrop: function(e) {
                    e.preventDefault();
                
                    this.setState({
                      isDragActive: false,
                Severity: Minor
                Found in app/assets/javascripts/react-dropzone.js.jsx - About 1 hr to fix

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

                    render: function() {
                      return (
                        <div className='new-post-buttons card-sp'>
                          <div className='new-post-wrap'>
                            <div className='new-post-label' onClick={this.onClickPhoto}>
                  Severity: Minor
                  Found in app/assets/javascripts/components/post_managment_panel.js.jsx - About 1 hr to fix

                    Function hide has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      Collapse.prototype.hide = function () {
                        if (this.transitioning || !this.$element.hasClass('in')) return
                    
                        var startEvent = $.Event('hide.bs.collapse')
                        this.$element.trigger(startEvent)
                    Severity: Minor
                    Found in app/assets/javascripts/bootstrap.js - About 1 hr to fix

                      Function onEndTransitionFn has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                                  var onEndTransitionFn = function( ev ) {
                                      if( support.transitions ) {
                                          if( ev.propertyName.indexOf( 'transform' ) === -1 ) return false;
                                          this.removeEventListener( transEndEventName, onEndTransitionFn );
                                      }
                      Severity: Minor
                      Found in app/assets/stylesheets/explore.js - About 1 hr to fix

                        Function onDrop has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          onDrop: function(e) {
                            e.preventDefault();
                        
                            this.setState({
                              isDragActive: false,
                        Severity: Minor
                        Found in app/assets/javascripts/react-dropzone.js.jsx - About 1 hr to fix

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

                            render(){
                              if (!this.props.post) return null;
                              console.log(this.props.post)
                              var post = this.props.post;
                              var author = post.author;
                          Severity: Minor
                          Found in app/assets/javascripts/components/show_explore_post.js.jsx - About 45 mins 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

                          Avoid deeply nested control flow statements.
                          Open

                                    for (var i = 0; i < target.length; ++i) {
                                      temp[i] = target[i];
                                    }
                          Severity: Major
                          Found in app/assets/javascripts/jquery.query-object.js - About 45 mins to fix

                            Method crop has 6 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                              def crop(x, y, w, h, all_h, all_w)
                            Severity: Minor
                            Found in app/uploaders/avatar_uploader.rb - About 45 mins to fix

                              Consider simplifying this complex logical expression.
                              Open

                                if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] > 2)) {
                                  throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher, but lower than version 3')
                                }
                              Severity: Major
                              Found in app/assets/javascripts/bootstrap.js - About 40 mins to fix

                                Function render has a Cognitive Complexity of 7 (exceeds 5 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 35 mins 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 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  render: function(){
                                    photos = this.props.photos;
                                    photos = photos.map(function (p, index) {
                                      return (
                                        <div key={index} className="usual-post-photo action-create-element-post">
                                Severity: Minor
                                Found in app/assets/javascripts/components/photos_box.js.jsx - About 35 mins 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