kennethkalmer/powerdns-on-rails

View on GitHub

Showing 179 of 179 total issues

Avoid deeply nested control flow statements.
Open

                    for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
                        if ( item ) {
                            found = filter( item, match, i, curLoop );
                            var pass = not ^ !!found;

Severity: Major
Found in public/javascripts/jquery.js - About 45 mins to fix

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

        if params[:auth_token][:record] && params[:auth_token][:record].size > 0
          params[:auth_token][:record].each do |r|
            name, type = r.split(':')
            @auth_token.can_change( name, type || '*' )
          end
    Severity: Minor
    Found in app/controllers/auth_tokens_controller.rb and 1 other location - About 40 mins to fix
    app/controllers/auth_tokens_controller.rb on lines 86..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 38.

    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 params[:auth_token][:protect] && params[:auth_token][:protect].size > 0
          params[:auth_token][:protect].each do |r|
            name, type = r.split(':')
            @auth_token.protect( name, type || '*' )
          end
    Severity: Minor
    Found in app/controllers/auth_tokens_controller.rb and 1 other location - About 40 mins to fix
    app/controllers/auth_tokens_controller.rb on lines 79..84

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

    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

    Consider simplifying this complex logical expression.
    Open

                        if((right_compare && w_compare < 0) || (t_class == "_right" && !left_compare) || (t_class == "_left" && left < (tip_w + opts.edgeOffset + 5))){
                            t_class = "_right";
                            arrow_top = Math.round(tip_h - 13) / 2;
                            arrow_left = -12;
                            marg_left = Math.round(left + org_width + opts.edgeOffset);
    Severity: Major
    Found in public/javascripts/jquery.tipTip.js - About 40 mins to fix

      Consider simplifying this complex logical expression.
      Open

              } else if ( typeof value === "string" && !rnocache.test( value ) &&
                  (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
                  !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
      
                  value = value.replace(rxhtmlTag, "<$1></$2>");
      Severity: Major
      Found in public/javascripts/jquery.js - About 40 mins to fix

        Consider simplifying this complex logical expression.
        Open

                if ( s.crossDomain == null ) {
                    parts = rurl.exec( s.url.toLowerCase() );
                    s.crossDomain = !!( parts &&
                        ( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] ||
                            ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
        Severity: Major
        Found in public/javascripts/jquery.js - About 40 mins to fix

          Consider simplifying this complex logical expression.
          Open

                  if ( (!id || (pvt && id && !cache[ id ][ internalKey ])) && getByName && data === undefined ) {
                      return;
                  }
          Severity: Major
          Found in public/javascripts/jquery.js - About 40 mins to fix

            Consider simplifying this complex logical expression.
            Open

                    if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
                            Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
            
                        ret = Sizzle.find( parts.shift(), context, contextXML );
                        context = ret.expr ?
            Severity: Major
            Found in public/javascripts/jquery.js - About 40 mins to fix

              Consider simplifying this complex logical expression.
              Open

                  if ( event.liveFired === this || !events || !events.live || event.target.disabled || event.button && event.type === "click" ) {
                      return;
                  }
              Severity: Major
              Found in public/javascripts/jquery.js - About 40 mins to fix

                Consider simplifying this complex logical expression.
                Open

                if ( jQuery.expr && jQuery.expr.filters ) {
                    jQuery.expr.filters.hidden = function( elem ) {
                        var width = elem.offsetWidth,
                            height = elem.offsetHeight;
                
                
                Severity: Major
                Found in public/javascripts/jquery.js - About 40 mins to fix

                  Consider simplifying this complex logical expression.
                  Open

                                  if ( (e.keyCode === 13 && !jQuery.nodeName( elem, "textarea" ) ) ||
                                      (e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||
                                      type === "select-multiple" ) {
                                      testChange.call( this, e );
                                  }
                  Severity: Major
                  Found in public/javascripts/jquery.js - About 40 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                    if ( !jQuery.support.opacity ) {
                        jQuery.cssHooks.opacity = {
                            get: function( elem, computed ) {
                                // IE uses filters for opacity
                                return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
                    Severity: Major
                    Found in public/javascripts/jquery.js - About 40 mins to fix

                      Function PSEUDO has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                              PSEUDO: function( match, curLoop, inplace, result, not ) {
                      Severity: Minor
                      Found in public/javascripts/jquery.js - About 35 mins to fix

                        Method hijack_method has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                          def hijack_method(klass, method_name, eval_string = nil, arg_names = [], &block)
                        Severity: Minor
                        Found in lib/hijacker.rb - About 35 mins to fix

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

                                      for ( ; i < length; i++ ) {
                                          value = callback( elems[ i ], i, arg );
                          
                                          if ( value != null ) {
                                              ret[ ret.length ] = value;
                          Severity: Minor
                          Found in public/javascripts/jquery.js and 1 other location - About 35 mins to fix
                          public/javascripts/jquery.js on lines 758..764

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

                          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

                                      for ( key in elems ) {
                                          value = callback( elems[ key ], key, arg );
                          
                                          if ( value != null ) {
                                              ret[ ret.length ] = value;
                          Severity: Minor
                          Found in public/javascripts/jquery.js and 1 other location - About 35 mins to fix
                          public/javascripts/jquery.js on lines 748..754

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

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

                            def get_name_and_type_from_param( record, type = nil )
                              name, type =
                                case record
                                when Record
                                  [ record.name, record.class.to_s ]
                          Severity: Minor
                          Found in app/models/auth_token.rb - About 35 mins to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Method apply_to has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def apply_to( domain )
                              Record.batch do
                                macro_steps.each do |step|
                          
                                  if step.action == 'create'
                          Severity: Minor
                          Found in app/models/macro.rb - About 35 mins to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Method update_convenience_accessors has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def update_convenience_accessors
                              # Setup our convenience values
                              @primary_ns, @contact, @serial, @refresh, @retry, @expire, @minimum =
                                self[:content].split(/\s+/) unless self[:content].blank?
                              %w{ serial refresh retry expire minimum }.each do |i|
                          Severity: Minor
                          Found in app/models/soa.rb - About 35 mins to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Method display_hash has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def display_hash( hash )
                              hash ||= {}
                              hash.map do |k,v|
                                if v.nil?
                                  nil # strip out non-values
                          Severity: Minor
                          Found in app/helpers/audits_helper.rb - About 35 mins to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Severity
                          Category
                          Status
                          Source
                          Language