techvision/brails4

View on GitHub

Showing 157 of 157 total issues

Function applyPlacement has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  Tooltip.prototype.applyPlacement = function(offset, placement) {
    var replace
    var $tip   = this.tip()
    var width  = $tip[0].offsetWidth
    var height = $tip[0].offsetHeight
Severity: Minor
Found in app/assets/javascripts/bootstrap.js - About 1 hr to fix

    Method completed? has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def completed?(user_id)
        user = User.find(user_id)
        if user.profile.achievements.empty?
          false
        else
    Severity: Minor
    Found in app/models/level.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

    Function ytvolup has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    function ytvolup(ytpid)
    {
      var ytp = document.getElementById("thisytp"+ytpid);
      if (new RegExp('^(' + ytplayer.join('|') + ')$').test(ytp.id)) 
      {
    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 ytvoldown has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    function ytvoldown(ytpid)
    {
      var ytp = document.getElementById("thisytp"+ytpid);
      if (new RegExp('^(' + ytplayer.join('|') + ')$').test(ytp.id)) 
      {
    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

    Method complete? has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def complete?(user_id)
        user = User.find(user_id)
        solved_attempts = user.profile.attempts.solved
        if solved_attempts.empty?
          return false
    Severity: Minor
    Found in app/models/content.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

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

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

      Function textarea has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                                          dc.textarea = $A.query('textarea', dc.containerDiv, function(){
                                              $A.css(this,
                                                              {
                                                              visibility: '',
                                                              display: ''
      Severity: Minor
      Found in app/assets/javascripts/calendar_generator.js - About 1 hr to fix

        Function backdrop has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          Modal.prototype.backdrop = function (callback) {
            var that    = this
            var animate = this.$element.hasClass('fade') ? 'fade' : ''
        
            if (this.isShown && this.options.backdrop) {
        Severity: Minor
        Found in app/assets/javascripts/bootstrap.js - About 1 hr to fix

          Function ytAddLoadListener has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function ytAddLoadListener(fn){
            if (typeof window.addEventListener != 'undefined') 
            {
              window.addEventListener('load', fn, false);
            }
          Severity: Minor
          Found in app/assets/javascripts/ytp.js - About 1 hr to fix

            Function cookie has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                var config = $.cookie = function (key, value, options) {
            
                    // Write
                    if (value !== undefined && !$.isFunction(value)) {
                        options = $.extend({}, config.defaults, options);
            Severity: Minor
            Found in app/assets/javascripts/jquery.cookie.js - About 1 hr to fix

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

                Modal.prototype.show = function (_relatedTarget) {
                  var that = this
                  var e    = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
              
                  this.$element.trigger(e)
              Severity: Minor
              Found in app/assets/javascripts/bootstrap.js - About 1 hr to fix

                Function ytPlayerBoxDraw has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function ytPlayerBoxDraw(aspect,ytpbox,pid)
                {
                  var width = "480px";
                  if (aspect == "normal") 
                  {
                Severity: Minor
                Found in app/assets/javascripts/ytp.js - About 1 hr to fix

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

                                                          0:
                                                                          {
                                                                          name: config.months && config.months[0] ? config.months[0] : 'January',
                                                                          max: 31,
                                                                          disabled: {},
                  Severity: Major
                  Found in app/assets/javascripts/calendar_generator.js and 11 other locations - About 1 hr to fix
                  app/assets/javascripts/calendar_generator.js on lines 71..77
                  app/assets/javascripts/calendar_generator.js on lines 78..84
                  app/assets/javascripts/calendar_generator.js on lines 85..91
                  app/assets/javascripts/calendar_generator.js on lines 92..98
                  app/assets/javascripts/calendar_generator.js on lines 99..105
                  app/assets/javascripts/calendar_generator.js on lines 106..112
                  app/assets/javascripts/calendar_generator.js on lines 113..119
                  app/assets/javascripts/calendar_generator.js on lines 120..126
                  app/assets/javascripts/calendar_generator.js on lines 127..133
                  app/assets/javascripts/calendar_generator.js on lines 134..140
                  app/assets/javascripts/calendar_generator.js on lines 141..147

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

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

                                                          2:
                                                                          {
                                                                          name: config.months && config.months[2] ? config.months[2] : 'March',
                                                                          max: 31,
                                                                          disabled: {},
                  Severity: Major
                  Found in app/assets/javascripts/calendar_generator.js and 11 other locations - About 1 hr to fix
                  app/assets/javascripts/calendar_generator.js on lines 64..70
                  app/assets/javascripts/calendar_generator.js on lines 71..77
                  app/assets/javascripts/calendar_generator.js on lines 85..91
                  app/assets/javascripts/calendar_generator.js on lines 92..98
                  app/assets/javascripts/calendar_generator.js on lines 99..105
                  app/assets/javascripts/calendar_generator.js on lines 106..112
                  app/assets/javascripts/calendar_generator.js on lines 113..119
                  app/assets/javascripts/calendar_generator.js on lines 120..126
                  app/assets/javascripts/calendar_generator.js on lines 127..133
                  app/assets/javascripts/calendar_generator.js on lines 134..140
                  app/assets/javascripts/calendar_generator.js on lines 141..147

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

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

                                                          6:
                                                                          {
                                                                          name: config.months && config.months[6] ? config.months[6] : 'July',
                                                                          max: 31,
                                                                          disabled: {},
                  Severity: Major
                  Found in app/assets/javascripts/calendar_generator.js and 11 other locations - About 1 hr to fix
                  app/assets/javascripts/calendar_generator.js on lines 64..70
                  app/assets/javascripts/calendar_generator.js on lines 71..77
                  app/assets/javascripts/calendar_generator.js on lines 78..84
                  app/assets/javascripts/calendar_generator.js on lines 85..91
                  app/assets/javascripts/calendar_generator.js on lines 92..98
                  app/assets/javascripts/calendar_generator.js on lines 99..105
                  app/assets/javascripts/calendar_generator.js on lines 113..119
                  app/assets/javascripts/calendar_generator.js on lines 120..126
                  app/assets/javascripts/calendar_generator.js on lines 127..133
                  app/assets/javascripts/calendar_generator.js on lines 134..140
                  app/assets/javascripts/calendar_generator.js on lines 141..147

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

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

                                                          1:
                                                                          {
                                                                          name: config.months && config.months[1] ? config.months[1] : 'February',
                                                                          max: 28,
                                                                          disabled: {},
                  Severity: Major
                  Found in app/assets/javascripts/calendar_generator.js and 11 other locations - About 1 hr to fix
                  app/assets/javascripts/calendar_generator.js on lines 64..70
                  app/assets/javascripts/calendar_generator.js on lines 78..84
                  app/assets/javascripts/calendar_generator.js on lines 85..91
                  app/assets/javascripts/calendar_generator.js on lines 92..98
                  app/assets/javascripts/calendar_generator.js on lines 99..105
                  app/assets/javascripts/calendar_generator.js on lines 106..112
                  app/assets/javascripts/calendar_generator.js on lines 113..119
                  app/assets/javascripts/calendar_generator.js on lines 120..126
                  app/assets/javascripts/calendar_generator.js on lines 127..133
                  app/assets/javascripts/calendar_generator.js on lines 134..140
                  app/assets/javascripts/calendar_generator.js on lines 141..147

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

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

                                                          4:
                                                                          {
                                                                          name: config.months && config.months[4] ? config.months[4] : 'May',
                                                                          max: 31,
                                                                          disabled: {},
                  Severity: Major
                  Found in app/assets/javascripts/calendar_generator.js and 11 other locations - About 1 hr to fix
                  app/assets/javascripts/calendar_generator.js on lines 64..70
                  app/assets/javascripts/calendar_generator.js on lines 71..77
                  app/assets/javascripts/calendar_generator.js on lines 78..84
                  app/assets/javascripts/calendar_generator.js on lines 85..91
                  app/assets/javascripts/calendar_generator.js on lines 99..105
                  app/assets/javascripts/calendar_generator.js on lines 106..112
                  app/assets/javascripts/calendar_generator.js on lines 113..119
                  app/assets/javascripts/calendar_generator.js on lines 120..126
                  app/assets/javascripts/calendar_generator.js on lines 127..133
                  app/assets/javascripts/calendar_generator.js on lines 134..140
                  app/assets/javascripts/calendar_generator.js on lines 141..147

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

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

                                                          8:
                                                                          {
                                                                          name: config.months && config.months[8] ? config.months[8] : 'September',
                                                                          max: 30,
                                                                          disabled: {},
                  Severity: Major
                  Found in app/assets/javascripts/calendar_generator.js and 11 other locations - About 1 hr to fix
                  app/assets/javascripts/calendar_generator.js on lines 64..70
                  app/assets/javascripts/calendar_generator.js on lines 71..77
                  app/assets/javascripts/calendar_generator.js on lines 78..84
                  app/assets/javascripts/calendar_generator.js on lines 85..91
                  app/assets/javascripts/calendar_generator.js on lines 92..98
                  app/assets/javascripts/calendar_generator.js on lines 99..105
                  app/assets/javascripts/calendar_generator.js on lines 106..112
                  app/assets/javascripts/calendar_generator.js on lines 113..119
                  app/assets/javascripts/calendar_generator.js on lines 127..133
                  app/assets/javascripts/calendar_generator.js on lines 134..140
                  app/assets/javascripts/calendar_generator.js on lines 141..147

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

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

                                                          3:
                                                                          {
                                                                          name: config.months && config.months[3] ? config.months[3] : 'April',
                                                                          max: 30,
                                                                          disabled: {},
                  Severity: Major
                  Found in app/assets/javascripts/calendar_generator.js and 11 other locations - About 1 hr to fix
                  app/assets/javascripts/calendar_generator.js on lines 64..70
                  app/assets/javascripts/calendar_generator.js on lines 71..77
                  app/assets/javascripts/calendar_generator.js on lines 78..84
                  app/assets/javascripts/calendar_generator.js on lines 92..98
                  app/assets/javascripts/calendar_generator.js on lines 99..105
                  app/assets/javascripts/calendar_generator.js on lines 106..112
                  app/assets/javascripts/calendar_generator.js on lines 113..119
                  app/assets/javascripts/calendar_generator.js on lines 120..126
                  app/assets/javascripts/calendar_generator.js on lines 127..133
                  app/assets/javascripts/calendar_generator.js on lines 134..140
                  app/assets/javascripts/calendar_generator.js on lines 141..147

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

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

                                                          7:
                                                                          {
                                                                          name: config.months && config.months[7] ? config.months[7] : 'August',
                                                                          max: 31,
                                                                          disabled: {},
                  Severity: Major
                  Found in app/assets/javascripts/calendar_generator.js and 11 other locations - About 1 hr to fix
                  app/assets/javascripts/calendar_generator.js on lines 64..70
                  app/assets/javascripts/calendar_generator.js on lines 71..77
                  app/assets/javascripts/calendar_generator.js on lines 78..84
                  app/assets/javascripts/calendar_generator.js on lines 85..91
                  app/assets/javascripts/calendar_generator.js on lines 92..98
                  app/assets/javascripts/calendar_generator.js on lines 99..105
                  app/assets/javascripts/calendar_generator.js on lines 106..112
                  app/assets/javascripts/calendar_generator.js on lines 120..126
                  app/assets/javascripts/calendar_generator.js on lines 127..133
                  app/assets/javascripts/calendar_generator.js on lines 134..140
                  app/assets/javascripts/calendar_generator.js on lines 141..147

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

                  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