fairplaysk/datacamp

View on GitHub

Showing 350 of 350 total issues

Avoid too many return statements within this function.
Open

            return jQuery.isNaN( ret ) ? orig : ret;
Severity: Major
Found in app/assets/javascripts/jquery.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return undefined;
    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.style.cssText;
      Severity: Major
      Found in app/assets/javascripts/jquery.js - About 30 mins to fix

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

            $('form[data-remote]').live('submit.rails', function (e) {
                $(this).callRemote();
                e.preventDefault();
            });
        Severity: Minor
        Found in app/assets/javascripts/rails.js and 1 other location - About 30 mins to fix
        app/assets/javascripts/rails.js on lines 100..103

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

        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

            $('a[data-remote],input[data-remote]').live('click.rails', function (e) {
                $(this).callRemote();
                e.preventDefault();
            });
        Severity: Minor
        Found in app/assets/javascripts/rails.js and 1 other location - About 30 mins to fix
        app/assets/javascripts/rails.js on lines 95..98

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

        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

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

                                  if price_hash[:price_range]
                                    supplier_hash[:final_price_min] = price_hash[:price_min]
                                    supplier_hash[:final_price_max] = price_hash[:price_max]
                                    supplier_hash[:final_price_range] = true
                                  else
        Severity: Minor
        Found in lib/etl/vvo_v2/suppliers_information_parser.rb and 1 other location - About 30 mins to fix
        lib/etl/vvo_v2/suppliers_information_parser.rb on lines 121..127

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

        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 header.match(/Telefón/)
                                supplier_hash[:supplier_phone] = content
                              elsif header.match(/Fax/)
                                supplier_hash[:supplier_fax] = content
                              elsif header.match(/E-mail/)
        Severity: Minor
        Found in lib/etl/vvo_v2/suppliers_information_parser.rb and 1 other location - About 30 mins to fix
        lib/etl/vvo_v2/customer_information_parser.rb on lines 90..98

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

        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

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

                                  if price_hash[:price_range]
                                    supplier_hash[:final_price_min] = price_hash[:price_min]
                                    supplier_hash[:final_price_max] = price_hash[:price_max]
                                    supplier_hash[:final_price_range] = true
                                  else
        Severity: Minor
        Found in lib/etl/vvo_v2/suppliers_information_parser.rb and 1 other location - About 30 mins to fix
        lib/etl/vvo_v2/suppliers_information_parser.rb on lines 258..264

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

        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

                          elsif header.match(/Telefón/)
                            customer_information_hash[:customer_phone] = content
                          elsif header.match(/Fax/)
                            customer_information_hash[:customer_fax] = content
                          elsif header.match(/E-mail/)
        Severity: Minor
        Found in lib/etl/vvo_v2/customer_information_parser.rb and 1 other location - About 30 mins to fix
        lib/etl/vvo_v2/suppliers_information_parser.rb on lines 233..241

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

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

                def self.parse_recipient_2007_2012(td)
                  proposal = {}
                  e = td.css('span.cervene').first
                  return proposal unless e
                  proposal[:name] = clean_string(e.text)
        Severity: Minor
        Found in app/models/parsers/donations_parser/parser.rb - About 25 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 restore has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def restore
              @account = User.find_by_restoration_code(params[:id] || ".")
              if request.put?
                user = params[:user]
                if user[:password].present? && user[:password] == user[:password_confirmation]
        Severity: Minor
        Found in app/controllers/settings/users_controller.rb - About 25 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 build_sphinx_search has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def build_sphinx_search(search, sphinx_search)
            search.query.predicates.each do |predicate|
              field_description = field_descriptions.find_by_identifier(predicate.search_field)
              operand = field_description.is_derived ? field_description.derived_value : field_description.identifier if field_description
              sphinx_search = predicate.add_to_sphinx_search(operand, sphinx_search)
        Severity: Minor
        Found in app/models/dataset_description.rb - About 25 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 new_from_session has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.new_from_session(session, request)
            begin
              self.current_session = self.find_or_create_by_session_id(session[:session_id])
            rescue
              begin
        Severity: Minor
        Found in app/models/session.rb - About 25 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 searched_datasets has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def searched_datasets
            datasets = DatasetDescription.where(:is_active => true)
            
            Rails.logger.info "search: find datasets"
        
        
        Severity: Minor
        Found in app/models/search_query.rb - About 25 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 digest_founders has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def digest_founders(table)
                founders = []
                table.xpath(".//tr").each do |founder_row|
                  founder_identification = founder_row.xpath(".//td[1]").inner_text.strip.split("\n")
                  founder_contribution = founder_row.xpath(".//td[3]").inner_text[1..-2].strip.split(' ')
        Severity: Minor
        Found in lib/etl/foundation_extraction.rb - About 25 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 all_bulletins_in_year has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.all_bulletins_in_year(in_year)
              document_url = "http://www2.uvo.gov.sk/sk/evestnik/-/vestnik/all"
              document = Nokogiri::HTML(Typhoeus::Request.get(document_url).body)
        
              links = []
        Severity: Minor
        Found in lib/etl/vvo_bulletin_extraction.rb - About 25 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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def create
            search_params = params[:search] || {}
            if search_params[:predicates]
              query = SearchQuery.query_with_predicates(create_predicates_from_hash(search_params[:predicates]), :scope => "dataset", :object => search_params[:dataset])
              search = Search.create(:query => query, :search_type => 'predicates', :session => @current_session)
        Severity: Minor
        Found in app/controllers/searches_controller.rb - About 25 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 build_attributes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def build_attributes(values)
              attributes = {}
        
              values.each_with_index do |value, index|
        
        
        Severity: Minor
        Found in app/services/csv_import/mapper.rb - About 25 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 show has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def show
            @data_repair = DataRepair.find(params[:id])
            begin
              @data = get_preview_data(@data_repair)
            rescue
        Severity: Minor
        Found in app/controllers/data_repairs_controller.rb - About 25 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 download_procurements has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.download_procurements(link_match, year_match)
              agent = Mechanize.new
              agent.get(SEARCH_URL)
              if year_match
                link_element = agent.page.link_with(text: year_match)
        Severity: Minor
        Found in lib/etl/vvo_checker_v2.rb - About 25 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