enkessler/cql

View on GitHub

Showing 12 of 12 total issues

Method gather_objects has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    def self.gather_objects(current_object, target_classes, filters)
      gathered_objects = [].tap { |objects| collect_all_in(target_classes, current_object, objects) }

      if filters
        filters.each do |filter|
Severity: Minor
Found in lib/cql/map_reduce.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 gather_objects has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def self.gather_objects(current_object, target_classes, filters)
      gathered_objects = [].tap { |objects| collect_all_in(target_classes, current_object, objects) }

      if filters
        filters.each do |filter|
Severity: Minor
Found in lib/cql/map_reduce.rb - About 1 hr to fix

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

        def space_transforms
          return unless @value_transforms.is_a?(Hash)
    
          new_values = {}
    
    
    Severity: Minor
    Found in lib/cql/query.rb and 1 other location - About 35 mins to fix
    lib/cql/query.rb on lines 111..124

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

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

        def initialize(directory, &block)
          # Set root object
          @data = directory
    
          # Populate configurables from DSL block
    Severity: Minor
    Found in lib/cql/query.rb - About 35 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

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

        def space_renamings
          return unless @name_transforms.is_a?(Hash)
    
          new_names = {}
    
    
    Severity: Minor
    Found in lib/cql/query.rb and 1 other location - About 35 mins to fix
    lib/cql/query.rb on lines 127..140

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

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

          def collect_all_in(targeted_classes, current_object, accumulated_objects)
            accumulated_objects << current_object if targeted_classes.any? { |targeted_class| (targeted_class == :all) || current_object.is_a?(targeted_class) }
    
            method_for_children = Gem.loaded_specs['cuke_modeler'].version.version[/^0/] ? :contains : :children
    
    
    Severity: Minor
    Found in lib/cql/map_reduce.rb - About 35 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

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

      task :run_cucumber_tests => [:clear_old_results] do # rubocop:disable Style/HashSyntax
        puts Rainbow('Running Cucumber tests...').cyan
        completed_process = CQL::CQLHelper.run_command(%w[bundle exec cucumber])
    
        raise(Rainbow('Cucumber tests encountered problems!').red) unless completed_process.exit_code.zero?
    Severity: Minor
    Found in rakefiles/testing_tasks.rb and 1 other location - About 25 mins to fix
    rakefiles/testing_tasks.rb on lines 4..10

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

    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

      task :run_rspec_tests => [:clear_old_results] do # rubocop:disable Style/HashSyntax
        puts Rainbow('Running RSpec tests...').cyan
        completed_process = CQL::CQLHelper.run_command(%w[bundle exec rspec])
    
        raise(Rainbow('RSpec tests encountered problems!').red) unless completed_process.exit_code.zero?
    Severity: Minor
    Found in rakefiles/testing_tasks.rb and 1 other location - About 25 mins to fix
    rakefiles/testing_tasks.rb on lines 14..20

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

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

        def space_renamings
          return unless @name_transforms.is_a?(Hash)
    
          new_names = {}
    
    
    Severity: Minor
    Found in lib/cql/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 determine_value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def determine_value(element, attribute, index)
          original_value = attribute.is_a?(Symbol) ? determine_special_value(element, attribute) : determine_normal_value(element, attribute)
    
          if @value_transforms
            value = mapped_attribute(@value_transforms, attribute, index)
    Severity: Minor
    Found in lib/cql/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 add_transforms has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def add_transforms(new_transforms, transform_set)
          # TODO: accept either array or a hash
          if new_transforms.first.is_a?(Hash)
            additional_transforms = new_transforms.first
    
    
    Severity: Minor
    Found in lib/cql/dsl.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 space_transforms has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def space_transforms
          return unless @value_transforms.is_a?(Hash)
    
          new_values = {}
    
    
    Severity: Minor
    Found in lib/cql/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

    Severity
    Category
    Status
    Source
    Language