fairplaysk/datacamp

View on GitHub

Showing 350 of 350 total issues

Method contract_information has a Cognitive Complexity of 23 (exceeds 5 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 3 hrs 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

Class DatasetDescription has 27 methods (exceeds 20 allowed). Consider refactoring.
Open

class DatasetDescription < ActiveRecord::Base
  has_many :similar_datasets,
           source: :dataset_description_source,
           foreign_key: :similar_source_id

Severity: Minor
Found in app/models/dataset_description.rb - About 3 hrs to fix

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

            "": function(checkSet, part, isXML){
                var nodeCheck,
                    doneName = done++,
                    checkFn = dirCheck;
    
    
    Severity: Major
    Found in app/assets/javascripts/jquery.js and 1 other location - About 3 hrs to fix
    app/assets/javascripts/jquery.js on lines 3425..3437

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

    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

            "~": function( checkSet, part, isXML ) {
                var nodeCheck,
                    doneName = done++,
                    checkFn = dirCheck;
    
    
    Severity: Major
    Found in app/assets/javascripts/jquery.js and 1 other location - About 3 hrs to fix
    app/assets/javascripts/jquery.js on lines 3411..3423

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

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

          def foundation
            registration_number = identification_number = name = address = objective = ''
            date_start = date_end = date_liquidation = date_registration = ''
            assets_value = assets_currency = nil
    
    
    Severity: Minor
    Found in lib/etl/foundation_extraction.rb - About 3 hrs 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

    Consider simplifying this complex logical expression.
    Open

    if ( "getBoundingClientRect" in document.documentElement ) {
        jQuery.fn.offset = function( options ) {
            var elem = this[0], box;
    
            if ( options ) { 
    Severity: Critical
    Found in app/assets/javascripts/jquery.js - About 3 hrs to fix

      Method create_predicates_from_tokens has 72 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def create_predicates_from_tokens(tokens)
          # puts "==> predicate from tokens #{tokens}"
      
          tokens.each { |token|
              # puts "--- token '#{token}'"
      Severity: Major
      Found in app/models/search_query.rb - About 2 hrs to fix

        Function animate has 71 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            animate: function( prop, speed, easing, callback ) {
                var optall = jQuery.speed(speed, easing, callback);
        
                if ( jQuery.isEmptyObject( prop ) ) {
                    return this.each( optall.complete );
        Severity: Major
        Found in app/assets/javascripts/jquery.js - About 2 hrs to fix

          Function trigger has 71 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              trigger: function( event, data, elem /*, bubbling */ ) {
                  // Event object or event type
                  var type = event.type || event,
                      bubbling = arguments[3];
          
          
          Severity: Major
          Found in app/assets/javascripts/jquery.js - About 2 hrs to fix

            File inscription.js has 282 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // 
            // inscription.js
            // jQuery-based javascript toolking
            // (c) Vojto Rinik
            
            
            Severity: Minor
            Found in app/assets/javascripts/inscription.js - About 2 hrs to fix

              Method digest has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                  def digest(doc)
                    employees = []
                    doc.xpath("//div[@id='dnn_ctr730_ModuleContent']/div[@class='TableFontItem']/table[@class='NuDetailTable']//div[@class='TableFontItem']/table[@class='NuDetailTable']/tr").each do |employee|
                      next if employee.xpath('.//td[1]').inner_text =~ /Meno|Deň|Pondelok|Utorok|Streda|Štvrtok|Piatok/
                      employee_name = employee.xpath('.//td[1]').inner_text
              Severity: Minor
              Found in lib/etl/notar_extraction.rb - About 2 hrs 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 val has 67 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  val: function( value ) {
                      if ( !arguments.length ) {
                          var elem = this[0];
              
                          if ( elem ) {
              Severity: Major
              Found in app/assets/javascripts/jquery.js - About 2 hrs to fix

                Function filter has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                Sizzle.filter = function( expr, set, inplace, not ) {
                    var match, anyFound,
                        old = expr,
                        result = [],
                        curLoop = set,
                Severity: Major
                Found in app/assets/javascripts/jquery.js - About 2 hrs to fix

                  Function init has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      init: function( selector, context ) {
                          var match, elem, ret, doc;
                  
                          // Handle $(""), $(null), or $(undefined)
                          if ( !selector ) {
                  Severity: Major
                  Found in app/assets/javascripts/jquery.js - About 2 hrs to fix

                    Method foundation has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def foundation
                            registration_number = identification_number = name = address = objective = ''
                            date_start = date_end = date_liquidation = date_registration = ''
                            assets_value = assets_currency = nil
                    
                    
                    Severity: Major
                    Found in lib/etl/foundation_extraction.rb - About 2 hrs to fix

                      Function clean has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          clean: function( elems, context, fragment, scripts ) {
                              context = context || document;
                      
                              // !context.createElement fails in IE with an error but returns typeof 'object'
                              if ( typeof context.createElement === "undefined" ) {
                      Severity: Major
                      Found in app/assets/javascripts/jquery.js - About 2 hrs to fix

                        Function attr has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            attr: function( elem, name, value, pass ) {
                                // don't set attributes on text and comment nodes
                                if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
                                    return undefined;
                                }
                        Severity: Major
                        Found in app/assets/javascripts/jquery.js - About 2 hrs to fix

                          Function liveHandler has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function liveHandler( event ) {
                              var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret,
                                  elems = [],
                                  selectors = [],
                                  events = jQuery.data( this, this.nodeType ? "events" : "__events__" );
                          Severity: Major
                          Found in app/assets/javascripts/jquery.js - About 2 hrs to fix

                            Method update has a Cognitive Complexity of 18 (exceeds 5 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 2 hrs 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

                            Class DatasetRecord has 22 methods (exceeds 20 allowed). Consider refactoring.
                            Open

                            class Dataset::DatasetRecord < ActiveRecord::Base
                              include ActionView::Helpers::NumberHelper
                              include ActionView::Helpers::TextHelper
                            
                              self.abstract_class = true
                            Severity: Minor
                            Found in app/models/dataset/dataset_record.rb - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language