fairplaysk/datacamp

View on GitHub

Showing 350 of 350 total issues

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

    def digest_attributes
      case dataset_type
        when :notice
          [
              # Basic information
Severity: Minor
Found in lib/etl/vvo_extraction_v2.rb - About 1 hr to fix

    Function init_tabs has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    var init_tabs = function(){
      $("ul.tabs").each(function(){
        // Add init class
        if($(this).hasClass('initialized'))
        {
    Severity: Minor
    Found in app/assets/javascripts/inscription.js - 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 error has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def error code, info = {}
        error = @@errors[code.to_sym]
        if error.nil?
          error = @@errors[:internal_inconsistency]
          @message = "Unknown error code '#{code}'"
    Severity: Minor
    Found in app/controllers/api_controller.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 set_up_relation has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def set_up_relation
          dataset_description.relations(true).each do |relation|
    
            left_association = (relation.relationship_dataset_description.identifier < dataset_description.identifier)
            if relation.respond_to?(:morph) && relation.morph?
    Severity: Minor
    Found in app/models/dataset/model_builder.rb - About 1 hr to fix

      Function callRemote has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              callRemote: function () {
                  var el      = this,
                      method  = el.attr('method') || el.attr('data-method') || 'GET',
                      url     = el.attr('action') || el.attr('href'),
                      dataType  = el.attr('data-type')  || ($.ajaxSettings && $.ajaxSettings.dataType);
      Severity: Minor
      Found in app/assets/javascripts/rails.js - About 1 hr to fix

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

            data: function( elem, name, data ) {
                if ( !jQuery.acceptData( elem ) ) {
                    return;
                }
        
        
        Severity: Minor
        Found in app/assets/javascripts/jquery.js - About 1 hr to fix

          Method parse_recipient_2013 has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def self.parse_recipient_2013(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 1 hr to fix

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

                def perform
                  document_ids = []
                  css_links = document.css('#layout-column_column-2 .portlet-body a')
                  any_valid_link = false
                  css_links.each do |css_link|
            Severity: Minor
            Found in lib/etl/vvo_bulletin_extraction.rb - About 1 hr to fix

              Function dirCheck has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
                  for ( var i = 0, l = checkSet.length; i < l; i++ ) {
                      var elem = checkSet[i];
              
                      if ( elem ) {
              Severity: Minor
              Found in app/assets/javascripts/jquery.js - About 1 hr to fix

                Function removeData has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    removeData: function( elem, name ) {
                        if ( !jQuery.acceptData( elem ) ) {
                            return;
                        }
                
                
                Severity: Minor
                Found in app/assets/javascripts/jquery.js - About 1 hr to fix

                  Function each has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      each: function( object, callback, args ) {
                          var name, i = 0,
                              length = object.length,
                              isObj = length === undefined || jQuery.isFunction(object);
                  
                  
                  Severity: Minor
                  Found in app/assets/javascripts/jquery.js - About 1 hr to fix

                    Function cookie has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        var config = $.cookie = function (key, value, options) {
                    
                            // Write
                    
                            if (value !== undefined && !$.isFunction(value)) {
                    Severity: Minor
                    Found in app/assets/javascripts/jquery.cookie.js - About 1 hr to fix

                      Function offset has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          jQuery.fn.offset = function( options ) {
                              var elem = this[0], box;
                      
                              if ( options ) { 
                                  return this.each(function( i ) {
                      Severity: Minor
                      Found in app/assets/javascripts/jquery.js - About 1 hr to fix

                        Function setOffset has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            setOffset: function( elem, options, i ) {
                                var position = jQuery.css( elem, "position" );
                        
                                // set position first, in-case top/left are set even on static elem
                                if ( position === "static" ) {
                        Severity: Minor
                        Found in app/assets/javascripts/jquery.js - About 1 hr to fix

                          Function init_search has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          var init_search = function(row, reset){
                          
                            row.find(".remove_row").click(function(){
                              row.remove();
                              return false;
                          Severity: Minor
                          Found in app/assets/javascripts/datasets/search.js - About 1 hr to fix

                            Function ATTR has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    ATTR: function( elem, match ) {
                                        var name = match[1],
                                            result = Expr.attrHandle[ name ] ?
                                                Expr.attrHandle[ name ]( elem ) :
                                                elem[ name ] != null ?
                            Severity: Minor
                            Found in app/assets/javascripts/jquery.js - About 1 hr to fix

                              Method parse_recipient_2007_2012 has 28 lines of code (exceeds 25 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 1 hr to fix

                                Method contract_information has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    def contract_information(document)
                                      contract_information_hash = {}
                                
                                      case document_type(document)
                                        when :standard
                                Severity: Minor
                                Found in lib/etl/vvo_extraction.rb - About 1 hr to fix

                                  Method save has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      def save(procurement_hash)
                                  
                                        # Empty suppliers - notification
                                        if procurement_hash[:suppliers].empty?
                                          update_report_object_depth_2(:download_procurement, :empty_suppliers, id, document_url(id))
                                  Severity: Minor
                                  Found in lib/etl/vvo_extraction.rb - About 1 hr to fix

                                    Method initialize_dataset has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                      def self.initialize_dataset(dataset_name, debug_output=false)
                                        unless DatasetDescription.where(identifier: dataset_name).exists?
                                          puts "initializing #{dataset_name}" if debug_output
                                          result = Dataset::TableToDataset.execute("ds_#{dataset_name}", dataset_name)
                                          if result.valid?
                                    Severity: Minor
                                    Found in lib/dataset/utils.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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language