fairplaysk/datacamp

View on GitHub

Showing 277 of 350 total issues

Function extend has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

jQuery.extend = jQuery.fn.extend = function() {
     var options, name, src, copy, copyIsArray, clone,
        target = arguments[0] || {},
        i = 1,
        length = arguments.length,
Severity: Minor
Found in app/assets/javascripts/jquery.js - About 1 hr to fix

    Function step has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        step: function( gotoEnd ) {
            var t = jQuery.now(), done = true;
    
            if ( gotoEnd || t >= this.options.duration + this.startTime ) {
                this.now = this.end;
    Severity: Minor
    Found in app/assets/javascripts/jquery.js - About 1 hr to fix

      Method get_formatted_value has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def get_formatted_value(field_description)
          value = get_value(field_description)
          # Apply format
          data_format = field_description.data_format
          if data_format
      Severity: Minor
      Found in app/models/dataset/dataset_record.rb - About 1 hr to fix

        Method parse_price2 has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

              def parse_price2(price_element)
                price_hash = {}
                price_elements = price_element.xpath(".//span[@class='hodnota']")
                if price_elements.size == 1
                  price_hash[:price] = parse_float(price_elements[0].inner_text.strip)
        Severity: Minor
        Found in lib/etl/vvo_v2/parser_includes.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_price1 has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

              def parse_price1(price_element)
                price_hash = {}
                if price_element.xpath(".//span").size == 1
                  price_hash[:price] = parse_float(price_element.xpath(".//span[1]").inner_text.strip)
                  price_hash[:price_interval] = false
        Severity: Minor
        Found in lib/etl/vvo_v2/parser_includes.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 hashchangeLoader has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                hashchangeLoader: function () {
                    var History = $.History;
                    
                    // More is needed for non IE8 browsers
                    if ( !($.browser.msie && parseInt($.browser.version) >= 8) ) {    
        Severity: Minor
        Found in app/assets/javascripts/jquery.history.js - About 1 hr to fix

          Function data has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              data: function( key, value ) {
                  var data = null;
          
                  if ( typeof key === "undefined" ) {
                      if ( this.length ) {
          Severity: Minor
          Found in app/assets/javascripts/jquery.js - About 1 hr to fix

            Method parse_price2 has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def parse_price2(price_element)
                    price_hash = {}
                    price_elements = price_element.xpath(".//span[@class='hodnota']")
                    if price_elements.size == 1
                      price_hash[:price] = parse_float(price_elements[0].inner_text.strip)
            Severity: Minor
            Found in lib/etl/vvo_v2/parser_includes.rb - About 1 hr to fix

              Method perform has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def perform
                    document_ids = {
                        notice: [],
                        performance: []
                    }
              Severity: Minor
              Found in lib/etl/vvo_bulletin_extraction_v2.rb - About 1 hr to fix

                Method parse_price1 has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def parse_price1(price_element)
                        price_hash = {}
                        if price_element.xpath(".//span").size == 1
                          price_hash[:price] = parse_float(price_element.xpath(".//span[1]").inner_text.strip)
                          price_hash[:price_interval] = false
                Severity: Minor
                Found in lib/etl/vvo_v2/parser_includes.rb - About 1 hr to fix

                  Function addListItem has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                              function addListItem(optionId) {
                  
                                  // add a new item to the html list
                  
                                  var $O = $('#' + optionId); 
                  Severity: Minor
                  Found in app/assets/javascripts/jquery.asmselect.js - About 1 hr to fix

                    Method digest has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def digest(doc)
                          lawyer_table = doc.xpath("//div[@class='section']/table[@class='filter']").first
                    
                          original_name = lawyer_table.xpath('./tr[1]/td[2]').inner_text.strip
                          name_ary = original_name.split
                    Severity: Minor
                    Found in lib/etl/lawyer_extraction.rb - About 1 hr to fix

                      Method update_source_url_and_document_id has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def self.update_source_url_and_document_id(sta_procurement, all_bulletins)
                            key = "#{sta_procurement.bulletin_id}/#{sta_procurement.year}"
                            url = all_bulletins[key]
                      
                            document = Nokogiri::HTML(Typhoeus::Request.get(url).body)
                      Severity: Minor
                      Found in lib/etl/vvo_extraction.rb - About 1 hr to fix

                        Function fix has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            fix: function( event ) {
                                if ( event[ jQuery.expando ] ) {
                                    return event;
                                }
                        
                        
                        Severity: Minor
                        Found in app/assets/javascripts/jquery.js - About 1 hr to fix

                          Consider simplifying this complex logical expression.
                          Open

                                      if ( match[1] === "nth" ) {
                                          // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
                                          var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
                                              match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
                                              !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
                          Severity: Critical
                          Found in app/assets/javascripts/jquery.js - About 1 hr to fix

                            Function toArray has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    toArray: function(o) {
                            
                                        o = o || {};
                                        var sDepth = o.startDepthCount || 0;
                                        var ret = [];
                            Severity: Minor
                            Found in app/assets/javascripts/jquery.ui.nestedSortable.js - About 1 hr to fix

                              Method digest has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  def digest(doc)
                                    ico = name = place = date_start = date_end = address = region = ''
                              
                                    trs = doc.css(".detailTable tr.detailTableRow")
                              
                              
                              Severity: Minor
                              Found in lib/etl/regis_extraction.rb - About 1 hr to fix

                                Method parse has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                      def self.parse(html, year)
                                        ::Parsers::Support.save(parse_location(year), 'csv', bucketize: false)
                                        CSV.open(::Parsers::Support.get_path(parse_location(year), bucketize: false), "wb", force_quotes: true) do |csv|
                                          csv << ATTRIBUTES
                                
                                
                                Severity: Minor
                                Found in app/models/parsers/donations_parser/parser.rb - About 1 hr to fix

                                  Function positionTooltip has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                          var positionTooltip = function(e){
                                              
                                              var posx = 0;
                                              var posy = 0;
                                              if (!e) var e = window.event;
                                  Severity: Minor
                                  Found in app/assets/javascripts/jquery.tooltip.js - About 1 hr to fix

                                    Method update has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      def update
                                        @dataset_description  = DatasetDescription.find_by_id(params[:id])
                                        @dataset_class        = @dataset_description.dataset_model
                                    
                                        if params[:record].blank?
                                    Severity: Minor
                                    Found in app/controllers/datasets_controller.rb - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language