fairplaysk/datacamp

View on GitHub

Showing 350 of 350 total issues

Method performance_information has 141 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def performance_information
        performance_information_hash = {}

        case document_format
          when :format1
Severity: Major
Found in lib/etl/vvo_v2/performance_information_parser.rb - About 5 hrs to fix

    Method procedure_information has 137 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def procedure_information
            procedure_information_hash = {}
    
            case document_format
              when :format1
    Severity: Major
    Found in lib/etl/vvo_v2/procedure_information_parser.rb - About 5 hrs to fix

      Method set_up_relation has a Cognitive Complexity of 36 (exceeds 5 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 5 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

      Method create_predicates_from_tokens has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
      Open

      def create_predicates_from_tokens(tokens)
          # puts "==> predicate from tokens #{tokens}"
      
          tokens.each { |token|
              # puts "--- token '#{token}'"
      Severity: Minor
      Found in app/models/search_query.rb - About 5 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

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

        $('a[href$=/expand]').live('click', function(){
          $(this).attr('href', $(this).attr('href').replace('expand', 'collapse'));
          $(this).text('Collapse');
          target = $(this).attr('href').replace('#/', '').replace('/expand', '').replace('/collapse', '');
          $("#"+target).slideDown();
      Severity: Major
      Found in app/assets/javascripts/datasets.js and 1 other location - About 5 hrs to fix
      app/assets/javascripts/datasets.js on lines 2..7

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

      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[href$=/collapse]').live('click', function(){
          $(this).attr('href', $(this).attr('href').replace('collapse', 'expand'));
          $(this).text('Expand');
          target = $(this).attr('href').replace('#/', '').replace('/expand', '').replace('/collapse', '');
          $("#"+target).slideUp();
      Severity: Major
      Found in app/assets/javascripts/datasets.js and 1 other location - About 5 hrs to fix
      app/assets/javascripts/datasets.js on lines 8..13

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

      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 customer_information has 121 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def customer_information
              customer_information_hash = {}
      
              case document_format
                when :format1
      Severity: Major
      Found in lib/etl/vvo_v2/customer_information_parser.rb - About 4 hrs to fix

        Consider simplifying this complex logical expression.
        Open

                if ( event.pageX == null && event.clientX != null ) {
                    var doc = document.documentElement,
                        body = document.body;
        
                    event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
        Severity: Critical
        Found in app/assets/javascripts/jquery.js - About 4 hrs to fix

          Method suppliers_information has 115 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def suppliers_information(document)
                suppliers = []
          
                case document_type(document)
                  when :standard
          Severity: Major
          Found in lib/etl/vvo_extraction.rb - About 4 hrs to fix

            Method header_procedure_and_project_information has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
            Open

                  def header_procedure_and_project_information
                    header_procedure_and_project_information_hash = {}
                    main_element = document.xpath("//div[@class='oznamenie']")
            
                    case document_format
            Severity: Minor
            Found in lib/etl/vvo_v2/basic_information_parser.rb - About 4 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 Sizzle has 108 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            var Sizzle = function( selector, context, results, seed ) {
                results = results || [];
                context = context || document;
            
                var origContext = context;
            Severity: Major
            Found in app/assets/javascripts/jquery.js - About 4 hrs to fix

              File vvo_extraction.rb has 334 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require 'fileutils'
              
              module Etl
                class VvoExtraction < Etl::Extraction
                  include Etl::Shared::VvoIncludes
              Severity: Minor
              Found in lib/etl/vvo_extraction.rb - About 4 hrs to fix

                Method show has 97 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def show
                    @dataset_description = DatasetDescription.find(params[:id])
                    @field_descriptions  = @dataset_description.visible_field_descriptions.includes(:data_format)
                    @dataset_class       = @dataset_description.dataset_model
                    @title               = @dataset_description.title
                Severity: Major
                Found in app/controllers/datasets_controller.rb - About 3 hrs to fix

                  Method page_entries_info_custom has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def page_entries_info_custom(collection, options = {})
                      model = options[:model]
                      model = collection.first.class unless model or collection.empty?
                      model ||= 'entry'
                      model_key = if model.respond_to? :model_name
                  Severity: Minor
                  Found in app/helpers/i18n_helper.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

                  Function remove has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      remove: function( elem, types, handler, pos ) {
                          // don't do events on text and comment nodes
                          if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
                              return;
                          }
                  Severity: Major
                  Found in app/assets/javascripts/jquery.js - About 3 hrs to fix

                    Method additional_information has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def additional_information
                            additional_information_hash = {}
                    
                            case document_format
                              when :format1
                    Severity: Major
                    Found in lib/etl/vvo_v2/additional_information_parser.rb - About 3 hrs to fix

                      Function _mouseDrag has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              _mouseDrag: function(event) {
                      
                                  //Compute the helpers position
                                  this.position = this._generatePosition(event);
                                  this.positionAbs = this._convertPositionTo("absolute");
                      Severity: Major
                      Found in app/assets/javascripts/jquery.ui.nestedSortable.js - About 3 hrs to fix

                        Method define_index_for_dataset has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def self.define_index_for_dataset(dataset_description)
                            reference = dataset_description.dataset_model.name.underscore
                            ThinkingSphinx::Index.define(reference, with: :active_record) do
                              indexes :_record_id
                              indexes :record_status
                        Severity: Minor
                        Found in lib/sphinx_dataset_index.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

                        Method perform has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def perform
                              document_ids = {
                                  notice: [],
                                  performance: []
                              }
                        Severity: Minor
                        Found in lib/etl/vvo_bulletin_extraction_v2.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

                        Function add has 83 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            add: function( elem, types, handler, data ) {
                                if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
                                    return;
                                }
                        
                        
                        Severity: Major
                        Found in app/assets/javascripts/jquery.js - About 3 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language