NUBIC/surveyor

View on GitHub

Showing 658 of 658 total issues

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

                case $.ui.keyCode.PAGE_DOWN:
                    newVal = this._trimAlignValue( curVal - ( (this._valueMax() - this._valueMin()) / numPages ) );
                    break;
Severity: Major
Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js and 1 other location - About 1 hr to fix
lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js on lines 11881..11883

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

Function transfer has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

$.effects.effect.transfer = function( o, done ) {
    var elem = $( this ),
        target = $( o.to ),
        targetFixed = target.css( "position" ) === "fixed",
        body = $("body"),
Severity: Minor
Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js - About 1 hr to fix

    Function _create has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        _create: function() {
            var selectees,
                that = this;
    
            this.element.addClass("ui-selectable");
    Severity: Minor
    Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js - About 1 hr to fix

      Function _initSource has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          _initSource: function() {
              var array, url,
                  that = this;
              if ( $.isArray(this.options.source) ) {
                  array = this.options.source;
      Severity: Minor
      Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js - About 1 hr to fix

        Function _create has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            _create: function() {
                this.originalCss = {
                    display: this.element[0].style.display,
                    width: this.element[0].style.width,
                    minHeight: this.element[0].style.minHeight,
        Severity: Minor
        Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js - About 1 hr to fix

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

          $.effects.effect.highlight = function( o, done ) {
              var elem = $( this ),
                  props = [ "backgroundImage", "backgroundColor", "opacity" ],
                  mode = $.effects.setMode( elem, o.mode || "show" ),
                  animation = {
          Severity: Minor
          Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js - About 1 hr to fix

            Function puff has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            $.effects.effect.puff = function( o, done ) {
                var elem = $( this ),
                    mode = $.effects.setMode( elem, o.mode || "hide" ),
                    hide = mode === "hide",
                    percent = parseInt( o.percent, 10 ) || 150,
            Severity: Minor
            Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js - About 1 hr to fix

              Function values has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  values: function( index, newValue ) {
                      var vals,
                          newValues,
                          i;
              
              
              Severity: Minor
              Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js - About 1 hr to fix

                Function _createWidget has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    _createWidget: function( options, element ) {
                        element = $( element || this.defaultElement || this )[ 0 ];
                        this.element = $( element );
                        this.uuid = uuid++;
                        this.eventNamespace = "." + this.widgetName + this.uuid;
                Severity: Minor
                Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js - About 1 hr to fix

                  Function _makeDraggable has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      _makeDraggable: function() {
                          var that = this,
                              options = this.options;
                  
                          function filteredUi( ui ) {
                  Severity: Minor
                  Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js - About 1 hr to fix

                    Function finish has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        finish: function( type ) {
                            if ( type !== false ) {
                                type = type || "fx";
                            }
                            return this.each(function() {
                    Severity: Minor
                    Found in lib/assets/javascripts/surveyor/jquery-1.9.0.js - About 1 hr to fix

                      Function looseParse has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              var looseParse = function(f,s,o){
                                  try{
                                      var d = new Date('2012-01-01 '+ s);
                                      if(isNaN(d.getTime())){
                                          d = new Date('2012-01-01T'+ s);
                      Severity: Minor
                      Found in lib/assets/javascripts/surveyor/jquery-ui-timepicker-addon.js - About 1 hr to fix

                        Function caret has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            caret: function(begin, end) {
                                var range;
                        
                                if (this.length === 0 || this.is(":hidden")) {
                                    return;
                        Severity: Minor
                        Found in lib/assets/javascripts/surveyor/jquery.maskedinput.js - About 1 hr to fix

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

                                  } else if (/^(ne)$/.test(a)) {
                                      that.size.width = newWidth;
                                      that.size.height = newHeight;
                                      that.position.top = op.top - oy;
                                  } else if (/^(sw)$/.test(a)) {
                          Severity: Major
                          Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js and 1 other location - About 1 hr to fix
                          lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js on lines 11009..11018

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

                          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

                              removeClass: function( classNames, speed, easing, callback ) {
                                  return speed ?
                                      $.effects.animateClass.call( this,
                                          { remove: classNames }, speed, easing, callback ) :
                                      this._removeClass( classNames );
                          Severity: Major
                          Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js and 1 other location - About 1 hr to fix
                          lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js on lines 7931..7936

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

                          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

                                  } else if (/^(sw)$/.test(a)) {
                                      that.size.width = newWidth;
                                      that.size.height = newHeight;
                                      that.position.left = op.left - ox;
                                  } else {
                          Severity: Major
                          Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js and 1 other location - About 1 hr to fix
                          lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js on lines 11005..11018

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

                          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

                              addClass: function( classNames, speed, easing, callback ) {
                                  return speed ?
                                      $.effects.animateClass.call( this,
                                          { add: classNames }, speed, easing, callback ) :
                                      this._addClass( classNames );
                          Severity: Major
                          Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js and 1 other location - About 1 hr to fix
                          lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js on lines 7939..7944

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

                          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

                          Method to_csv has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                                def to_csv(access_code = false, print_header = true)
                                  result = Surveyor::Common.csv_impl.generate do |csv|
                                    if print_header
                                      csv << (access_code ? ["response set access code"] : []) +
                                        csv_question_columns.map{|qcol| "question.#{qcol}"} +
                          Severity: Minor
                          Found in lib/surveyor/models/response_set_methods.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

                          Method parse has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def parse(str, filename)
                                csvlib = Surveyor::Common.csv_impl
                                begin
                                  csvlib.parse(str, :headers => :first_row, :return_headers => true, :header_converters => :symbol) do |r|
                                    if r.header_row? # header row
                          Severity: Minor
                          Found in lib/surveyor/redcap_parser.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 _setupHeightStyle has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              _setupHeightStyle: function( heightStyle ) {
                                  var maxHeight,
                                      parent = this.element.parent();
                          
                                  if ( heightStyle === "fill" ) {
                          Severity: Minor
                          Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language