thehyve/puppet-i2b2

View on GitHub

Showing 8 of 8 total issues

Method deferred_validate has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def deferred_validate(values)
      cur_values = retrieve
      devfail("#{cur_values} is not an array") unless cur_values.instance_of?(Array)

      values.each do |v|
Severity: Minor
Found in lib/puppet/type/i2b2_user_roles.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 create_param_type has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  def self.create_param_type(target_class, method_suffix, &block_constant)
    target_class.send(:define_method,
                      "new_#{method_suffix}") do |name, options = {}, &block_specific|

      gen_method = options[:create_property] ? :newproperty : :newparam
Severity: Minor
Found in lib/puppet_x/thehyve/i2b2_param_mixin.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 autorequire has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def autorequire(rel_catalog = nil)
    res = []
    role = rel_catalog.resource(:'I2b2::I2b2_user', self[:username])
    fail("Could not find I2b2::I2b2_user[#{self[:username]}]") if role.nil?

Severity: Minor
Found in lib/puppet/type/i2b2_user_roles.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 insync? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def insync?(is)
      return false if is == :absent

      # go over each one
      result = true
Severity: Minor
Found in lib/puppet/type/modified_properties_file.rb - About 45 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 refresh has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def refresh
    original = template_values
    result = template_values.merge resource[:values]

    unless resource.allow_new?

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

  def roles=(should_roles)
    new_roles = should_roles - roles
    removed_roles = roles - should_roles

    unless new_roles.empty?
Severity: Minor
Found in lib/puppet/provider/i2b2_user_roles/pg_i2b2_user_roles.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 current_values has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def current_values
    return @current_values unless @current_values.nil?
    return :absent unless File.file? resource[:target]

    @current_values = load resource[:target]

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

  def values
    return @property_hash[:values] if @property_hash.has_key? :values

    @property_hash[:values] = begin
      sql = "SELECT #{value_columns} FROM #{table} #{where_clause}"
Severity: Minor
Found in lib/puppet/provider/table_row/pg_table_row_provider.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