fairplaysk/datacamp

View on GitHub

Showing 350 of 350 total issues

Avoid deeply nested control flow statements.
Open

                        if ( pos == null ) {
                            eventType.splice( j--, 1 );
                        }
Severity: Major
Found in app/assets/javascripts/jquery.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if ( special[ type ] ) {
                                jQuery.event.remove( elem, type );
    
                            } else {
                                jQuery.removeEvent( elem, type, data.handle );
    Severity: Major
    Found in app/assets/javascripts/jquery.js - About 45 mins to fix

      Method visible_field_descriptions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def visible_field_descriptions(type = nil, limit = nil)
          type ||= :listing
          where = "is_visible_in_#{type.to_s}".to_sym
          @field_descriptions_cache = {} unless @field_descriptions_cache
          if @field_descriptions_cache[type]
      Severity: Minor
      Found in app/models/dataset_description.rb - About 45 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

      Avoid deeply nested control flow statements.
      Open

                              for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
                                  className = className.replace(" " + classNames[c] + " ", " ");
                              }
      Severity: Major
      Found in app/assets/javascripts/jquery.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if ( typeof cur !== "string" ) {
                                if ( elem === cur ) {
                                    match = true;
                                    break;
                                }
        Severity: Major
        Found in app/assets/javascripts/jquery.js - About 45 mins to fix

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

            def create
              logout_keeping_session!
              user = User.authenticate(params[:login], params[:password])
              if user
                # Protects against session fixation attacks, causes request forgery
          Severity: Minor
          Found in app/controllers/sessions_controller.rb - About 45 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 log_changes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def log_changes
              change_details = []
              changed_attributes.each do |attribute, old_value|
                next if attribute == "updated_at"
                next if old_value == self[attribute]
          Severity: Minor
          Found in app/models/dataset_description.rb - About 45 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

          Avoid deeply nested control flow statements.
          Open

                                  if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && 
                                          (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
          
                                      // Get the specific value for the option
                                      value = jQuery(option).val();
          Severity: Major
          Found in app/assets/javascripts/jquery.js - About 45 mins to fix

            Function access has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                access: function( elems, key, value, exec, fn, pass ) {
            Severity: Minor
            Found in app/assets/javascripts/jquery.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                              } else if ( copy !== undefined ) {
                                  target[ name ] = copy;
                              }
              Severity: Major
              Found in app/assets/javascripts/jquery.js - About 45 mins to fix

                Function CLASS has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        CLASS: function( match, curLoop, inplace, result, not, isXML ) {
                Severity: Minor
                Found in app/assets/javascripts/jquery.js - About 45 mins to fix

                  Function ATTR has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          ATTR: function( match, curLoop, inplace, result, not, isXML ) {
                  Severity: Minor
                  Found in app/assets/javascripts/jquery.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if ( ret[r] === ret[n] ) {
                                                ret.splice(n--, 1);
                                                break;
                                            }
                    Severity: Major
                    Found in app/assets/javascripts/jquery.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          if ( !inplace ) {
                                              curLoop = result;
                                          }
                      Severity: Major
                      Found in app/assets/javascripts/jquery.js - About 45 mins to fix

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

                          def create
                            # Special case when we wanna automagically create description for some field
                        
                            @field_description = @dataset_description.field_descriptions.build(params[:field_description])
                        
                        
                        Severity: Minor
                        Found in app/controllers/field_descriptions_controller.rb - About 45 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

                        Avoid deeply nested control flow statements.
                        Open

                                            if ( !anyFound ) {
                                                return [];
                                            }
                        Severity: Major
                        Found in app/assets/javascripts/jquery.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                if type_element.inner_text.match(/Tovary/) && category_element.inner_text.match(/Tovary/)
                                                  category_element = next_element(category_element)
                                                  place_is_next = true
                                                end
                          Severity: Major
                          Found in lib/etl/vvo_v2/contract_information_parser.rb - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                if project_type_matches
                                                  project_type = project_type_matches[2]
                                                end
                            Severity: Major
                            Found in lib/etl/vvo_v2/contract_information_parser.rb - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                supplier[:supplier_ico] = ico if code.next.xpath(".//table[1]//tr[2]").inner_text.match(/I(Č|C)O/)
                              Severity: Major
                              Found in lib/etl/vvo_extraction.rb - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                      if category_element.inner_text.match(/Kategórie služieb sú uvedené v prílohe C1/)
                                                        content = category_element.xpath(".//span[2]").inner_text.strip
                                                      elsif category_element.inner_text.match(/Kategória služby číslo/)
                                                        category_element = next_element(category_element)
                                                        content = category_element.xpath(".//span[2]").inner_text.strip
                                Severity: Major
                                Found in lib/etl/vvo_v2/contract_information_parser.rb - About 45 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language