studpad/studpad

View on GitHub

Showing 280 of 280 total issues

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

    self.unlock = (function() {
      var original = self.unlock;
      return function() {
        var sortable = self.$control.data('sortable');
        if (sortable) sortable.enable();
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 3416..3423

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

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

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

        $('#classroom_name').change(function(){
          val = $(this).val();
          if(val){
            $('#btn-create-class').removeAttr('disabled');
          }
      Severity: Major
      Found in app/assets/javascripts/my_scripts.js and 1 other location - About 2 hrs to fix
      app/assets/javascripts/my_scripts.js on lines 257..265

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

      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

        $('#community_name').change(function(){
          val = $(this).val();
          if(val){
            $('#btn-create-community').removeAttr('disabled');
          }
      Severity: Major
      Found in app/assets/javascripts/my_scripts.js and 1 other location - About 2 hrs to fix
      app/assets/javascripts/my_scripts.js on lines 247..255

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

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

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

                  <div className='new-post-label' onClick={this.onClickVideo}>
                    <div className='icon-post-cite icon-post'>
                      <img src = '/images/video.png' />
                    </div>
                    <span className='new-post-label-name'>Видео</span>
        app/assets/javascripts/components/post_managment_panel.js.jsx on lines 39..44
        app/assets/javascripts/components/post_managment_panel.js.jsx on lines 51..56

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

        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 3 locations. Consider refactoring.
        Open

                  <div className='new-post-label' onClick={this.onClickLink}>
                    <div className='icon-post-link icon-post'>
                      <img src = '/images/link.png' />
                    </div>
                    <span className='new-post-label-name'>Ссылка</span>
        app/assets/javascripts/components/post_managment_panel.js.jsx on lines 39..44
        app/assets/javascripts/components/post_managment_panel.js.jsx on lines 45..50

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

        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 3 locations. Consider refactoring.
        Open

                  <div className='new-post-label' onClick={this.onClickPhoto}>
                    <div className='icon-post-photo icon-post'>
                      <img src = '/images/photo.png'/>
                    </div>
                    <span className='new-post-label-name'>Фото</span>
        app/assets/javascripts/components/post_managment_panel.js.jsx on lines 45..50
        app/assets/javascripts/components/post_managment_panel.js.jsx on lines 51..56

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

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

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

            $.ajax({
              url: likedPost.like_path,
              type: 'PUT',
              error: function(xhr, status, err) {
                console.error(this.props.url, status, err.toString());
        Severity: Major
        Found in app/assets/javascripts/components/post_box.js.jsx and 2 other locations - About 2 hrs to fix
        app/assets/javascripts/components/post_box.js.jsx on lines 242..248
        app/assets/javascripts/explore_grid.js.jsx on lines 125..131

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

        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 3 locations. Consider refactoring.
        Open

            $.ajax({
              url: likedPost.like_path,
              type: 'PUT',
              error: function(xhr, status, err) {
                console.error(this.props.url, status, err.toString());
        Severity: Major
        Found in app/assets/javascripts/explore_grid.js.jsx and 2 other locations - About 2 hrs to fix
        app/assets/javascripts/components/post_box.js.jsx on lines 216..222
        app/assets/javascripts/components/post_box.js.jsx on lines 242..248

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

        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 3 locations. Consider refactoring.
        Open

            $.ajax({
              url: thisPost.basket_path,
              type: 'PUT',
              error: function(xhr, status, err) {
                console.error(this.props.url, status, err.toString());
        Severity: Major
        Found in app/assets/javascripts/components/post_box.js.jsx and 2 other locations - About 2 hrs to fix
        app/assets/javascripts/components/post_box.js.jsx on lines 216..222
        app/assets/javascripts/explore_grid.js.jsx on lines 125..131

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

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

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

              onDragLeave: function(e) {
                e.preventDefault();
            
                this.setState({
                  isDragActive: false,
            Severity: Major
            Found in app/assets/javascripts/react-dropzone.js.jsx and 1 other location - About 1 hr to fix
            app/assets/javascripts/react-dropzone.js.jsx on lines 256..267

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

            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

              onDragLeave: function(e) {
                e.preventDefault();
            
                this.setState({
                  isDragActive: false,
            Severity: Major
            Found in app/assets/javascripts/react-dropzone.js.jsx and 1 other location - About 1 hr to fix
            app/assets/javascripts/react-dropzone.js.jsx on lines 80..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 73.

            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 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
                Severity
                Category
                Status
                Source
                Language