fairplaysk/datacamp

View on GitHub

Showing 277 of 350 total issues

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 app/assets/javascripts/jquery.js - About 40 mins to fix

    Consider simplifying this complex logical expression.
    Open

                      elsif (code_text.match(/V\.*.*?[^\d]3[^\d]$/) || code_text.match(/V\.*.*?[^\d]4[^\d]$/)) && (header_text.match(/Názov a adresa/) || header_text.match(/NÁZOV A ADRESA/) || header_text.match(/Meno(.*)adresa(.*)víťaza/))
                        supplier_information = next_element(code.parent)
                        supplier_hash[:supplier_name] = supplier_information.xpath("./span[@class='titleValue']/span[1]").inner_text.strip
                        supplier_hash[:supplier_organisation_code] = supplier_information.xpath(".//span[@class='titleValue']/span[3]").inner_text.strip
    
    
    Severity: Major
    Found in lib/etl/vvo_v2/suppliers_information_parser.rb - 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 app/assets/javascripts/jquery.js - About 35 mins to fix

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

            def initialize(identifier, schema_manager, description_creator, system_columns, supported_types)
        Severity: Minor
        Found in app/models/dataset/table_describer.rb - About 35 mins to fix

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

              def initialize(url, reset_url = nil, cookie = nil, parent_url = nil, filter = nil)
          Severity: Minor
          Found in lib/etl/lawyer_extraction.rb - About 35 mins to fix

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

              def initialize(path, col_sep, encoding, skip_first_line = false, has_header = true)
            Severity: Minor
            Found in lib/csv_file.rb - About 35 mins to fix

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

                  def parse_for_links(doc, reset_url, cookie, parent_url, filter)
              Severity: Minor
              Found in lib/etl/lawyer_extraction.rb - About 35 mins to fix

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

                    def initialize(url, reset_url = nil, cookie = nil, parent_url = nil, filter = nil)
                Severity: Minor
                Found in lib/etl/lawyer_partnership_extraction.rb - About 35 mins to fix

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

                      def parse_for_links(doc, reset_url, cookie, parent_url, filter)
                  Severity: Minor
                  Found in lib/etl/lawyer_partnership_extraction.rb - About 35 mins to fix

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

                        def initialize(url, reset_url = nil, cookie = nil, parent_url = nil, filter = nil)
                    Severity: Minor
                    Found in lib/etl/lawyer_associate_extraction.rb - About 35 mins to fix

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

                          def parse_for_links(doc, reset_url, cookie, parent_url, filter)
                      Severity: Minor
                      Found in lib/etl/lawyer_associate_extraction.rb - About 35 mins to fix

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

                          def update
                            @field_description = FieldDescription.find_by_id(params[:id])
                        
                            respond_to do |format|
                              if @field_description.update_attributes(params[:field_description])
                        Severity: Minor
                        Found in app/controllers/field_descriptions_controller.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

                        Function modal has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                        $.modal = function(options){
                          inscription_modal_remove();
                          
                          options = $.extend({
                            position: 'center',
                        Severity: Minor
                        Found in app/assets/javascripts/inscription.js - 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 sort_link has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def sort_link(field)
                            params[:dir] ||= "asc"
                            lab = html_escape(field.title).html_safe
                            lab += image_tag "sort_#{params["dir"]}.png" if params[:sort] == field.identifier
                        
                        
                        Severity: Minor
                        Found in app/helpers/datasets_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

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

                          def has_right?(right)
                            # Super-user has all the rights
                            return true if is_super_user
                        
                            # Check for particular rights
                        Severity: Minor
                        Found in app/models/user.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 parse_all_downloaded_documents_for_type has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def self.parse_all_downloaded_documents_for_type(dataset_type)
                              ids = Dir.glob("data/#{Rails.env}/vvo/procurements/*/*.html").map { |n| File.basename(n, ".html").to_i }
                              ids.each_with_index do |document_id, index|
                                ext = Etl::VvoExtractionV2.new(document_id)
                                if ext.dataset_type == dataset_type
                        Severity: Minor
                        Found in lib/etl/vvo_extraction_v2.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 dataset_type has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def self.dataset_type(document_type)
                              return nil unless document_type
                              if document_type.start_with?('V') || document_type.start_with?('IP')
                                :notice
                              elsif document_type.start_with?('IZ') || document_type.start_with?('ID')
                        Severity: Minor
                        Found in lib/etl/vvo_extraction_v2.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

                        Avoid too many return statements within this function.
                        Open

                                        return (context || rootjQuery).find( selector );
                        Severity: Major
                        Found in app/assets/javascripts/jquery.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                      return elem[ name ];
                          Severity: Major
                          Found in app/assets/javascripts/jquery.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    return attr === null ? undefined : attr;
                            Severity: Major
                            Found in app/assets/javascripts/jquery.js - About 30 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language