zuazo/mysql_tuning-cookbook

View on GitHub

Showing 4 of 4 total issues

Method get_samples has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def get_samples(variable)
    samples = node['mysql_tuning']['configuration_samples']
    samples.each_with_object({}) do |(mem, sample), r|
      next unless sample.key?('mysqld')
      next unless sample['mysqld'].key?(variable)
Severity: Minor
Found in scripts/plot_variables.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 samples_interpolate_group has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def samples_interpolate_group(cnf_samples, group, keys, default_type, types)
Severity: Minor
Found in libraries/cookbook_helpers.rb - About 35 mins to fix

    Method samples_key_numeric? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def samples_key_numeric?(cnf_samples, group, key)
          cnf_samples.reduce(false) do |r, (_mem, cnf)|
            next true if r
            if cnf.key?(group)
              MysqlTuningCookbook::MysqlHelpers.numeric?(cnf[group][key])
    Severity: Minor
    Found in libraries/cookbook_helpers.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 fix_variable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.fix_variable(name, old_names, version)
            return name unless old_names.key?(name)
            result = name
            old_names[name].each do |requirement, old_name|
              next unless version_satisfies?(version, requirement)
    Severity: Minor
    Found in libraries/mysql_helpers_cnf.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