techvision/brails4

View on GitHub

Showing 157 of 157 total issues

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

                                                        {
                                                        shrt: config.days && config.days[6] ? config.days[6].s : 'S',
                                                        lng: config.days && config.days[6] ? config.days[6].l : 'Saturday'
                                                        }
Severity: Major
Found in app/assets/javascripts/calendar_generator.js and 6 other locations - About 2 hrs to fix
app/assets/javascripts/calendar_generator.js on lines 150..153
app/assets/javascripts/calendar_generator.js on lines 154..157
app/assets/javascripts/calendar_generator.js on lines 158..161
app/assets/javascripts/calendar_generator.js on lines 162..165
app/assets/javascripts/calendar_generator.js on lines 166..169
app/assets/javascripts/calendar_generator.js on lines 170..173

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

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

                                                        {
                                                        shrt: config.days && config.days[3] ? config.days[3].s : 'W',
                                                        lng: config.days && config.days[3] ? config.days[3].l : 'Wednesday'
                                                        },
Severity: Major
Found in app/assets/javascripts/calendar_generator.js and 6 other locations - About 2 hrs to fix
app/assets/javascripts/calendar_generator.js on lines 150..153
app/assets/javascripts/calendar_generator.js on lines 154..157
app/assets/javascripts/calendar_generator.js on lines 158..161
app/assets/javascripts/calendar_generator.js on lines 166..169
app/assets/javascripts/calendar_generator.js on lines 170..173
app/assets/javascripts/calendar_generator.js on lines 174..177

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

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

                                                        {
                                                        shrt: config.days && config.days[0] ? config.days[0].s : 'S',
                                                        lng: config.days && config.days[0] ? config.days[0].l : 'Sunday'
                                                        },
Severity: Major
Found in app/assets/javascripts/calendar_generator.js and 6 other locations - About 2 hrs to fix
app/assets/javascripts/calendar_generator.js on lines 154..157
app/assets/javascripts/calendar_generator.js on lines 158..161
app/assets/javascripts/calendar_generator.js on lines 162..165
app/assets/javascripts/calendar_generator.js on lines 166..169
app/assets/javascripts/calendar_generator.js on lines 170..173
app/assets/javascripts/calendar_generator.js on lines 174..177

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

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

tabpanel.prototype.handlePanelKeyDown = function($elem, e) {

  if (e.altKey) {
    // do nothing
    return true;
Severity: Major
Found in app/assets/javascripts/tabPanel.js - About 2 hrs to fix

    Function slide has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      Carousel.prototype.slide = function (type, next) {
        var $active   = this.$element.find('.item.active')
        var $next     = next || $active[type]()
        var isCycling = this.interval
        var direction = type == 'next' ? 'left' : 'right'
    Severity: Minor
    Found in app/assets/javascripts/bootstrap.js - About 1 hr to fix

      Function handlePanelKeyDown has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      tabpanel.prototype.handlePanelKeyDown = function($elem, e) {
      
        if (e.altKey) {
          // do nothing
          return true;
      Severity: Minor
      Found in app/assets/javascripts/tabPanel.js - 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 ytPlayerDispatch has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      function ytPlayerDispatch(ytp,ytpid) 
      {
        if (ytp) 
        {
          // get movie urls, titles, and other set up variables from page
      Severity: Minor
      Found in app/assets/javascripts/ytp.js - 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 handleTabKeyDown has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      tabpanel.prototype.handleTabKeyDown = function($tab, e) {
      
        if (e.altKey) {
          // do nothing
          return true;
      Severity: Minor
      Found in app/assets/javascripts/tabPanel.js - 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

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

        $(window).on('load', function () {
          $('[data-ride="carousel"]').each(function () {
            var $carousel = $(this)
            $carousel.carousel($carousel.data())
          })
      Severity: Major
      Found in app/assets/javascripts/bootstrap.js and 1 other location - About 1 hr to fix
      app/assets/javascripts/bootstrap.js on lines 1729..1734

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

      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

        $(window).on('load', function () {
          $('[data-spy="scroll"]').each(function () {
            var $spy = $(this)
            $spy.scrollspy($spy.data())
          })
      Severity: Major
      Found in app/assets/javascripts/bootstrap.js and 1 other location - About 1 hr to fix
      app/assets/javascripts/bootstrap.js on lines 483..488

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

      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

          case key.left: {
            if(activeElement.parent().prev.length != 0) {
              activeElement.parent().prev().children().focus();
            }
            break;
      Severity: Major
      Found in app/assets/javascripts/grid.js and 1 other location - About 1 hr to fix
      app/assets/javascripts/grid.js on lines 40..45

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

      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

          case key.right: {
            if(activeElement.parent().next.length != 0) {
              activeElement.parent().next().children().focus();
            }
      break;
      Severity: Major
      Found in app/assets/javascripts/grid.js and 1 other location - About 1 hr to fix
      app/assets/javascripts/grid.js on lines 46..51

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

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

                              runAfter: function(dc){
                                  $A.query('button', dc.containerDiv, function(){
                                      dc.commentBtn = this;
                                      $A.bind(this,
                                                      {
      Severity: Minor
      Found in app/assets/javascripts/calendar_generator.js - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

                                    if (dc.openEditor){
                                        dc.comments = dc.parent.range[dc.parent.range.current.month].comments;
        
                                        if (!dc.textarea)
                                            dc.textarea = $A.query('textarea', dc.containerDiv, function(){
        Severity: Critical
        Found in app/assets/javascripts/calendar_generator.js - About 1 hr to fix

          Function show has 41 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: Minor
          Found in app/assets/javascripts/bootstrap.js - About 1 hr to fix

            Method create has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

              def create
                if current_user      
                  if Attempt.create_attempt(current_user, params[:attempt])
                    flash[:notice] = 'Correct Answer!!'
                    topic = Question.find(params[:attempt][:question_id]).questionable
            Severity: Minor
            Found in app/controllers/attempts_controller.rb - 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

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

                                                                    if ((dc.range.current.mDay + 7) <= dc.range[dc.range.current.month].max){
                                                                        dc.range.current.mDay += 7;
                                                                        dc.setFocus(dc.range.index[dc.range.current.mDay - 1], this);
                                                                    }
            
            
            Severity: Major
            Found in app/assets/javascripts/calendar_generator.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/calendar_generator.js on lines 499..518

            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

                                                                    if ((dc.range.current.mDay - 7) > 0){
                                                                        dc.range.current.mDay -= 7;
                                                                        dc.setFocus(dc.range.index[dc.range.current.mDay - 1], this);
                                                                    }
            
            
            Severity: Major
            Found in app/assets/javascripts/calendar_generator.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/calendar_generator.js on lines 522..535

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

            function ytPlayerDispatch(ytp,ytpid) 
            {
              if (ytp) 
              {
                // get movie urls, titles, and other set up variables from page
            Severity: Minor
            Found in app/assets/javascripts/ytp.js - About 1 hr to fix

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

              function navigateGrid(e) {
                var key = new keyCodes();
                var activeElement = $(":focus");
              
                switch(e.keyCode) {
              Severity: Minor
              Found in app/assets/javascripts/grid.js - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language