leoniv/ass_updater

View on GitHub

Showing 3 of 3 total issues

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

  def instaled_versions(tmplt_root)
    (Dir.entries(conf_distribs_local_path(tmplt_root)).map do |e|
      next if e == '.' || e == '..'
      begin
        v = AssUpdater::AssVersion.new(e.split('_').join('.'))
Severity: Minor
Found in lib/ass_updater.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 required_versions_for_update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def required_versions_for_update(from_ver = nil, to_ver = nil)
    from_ver = AssUpdater::AssVersion.new(from_ver)
    to_ver = AssUpdater::AssVersion.new(to_ver || update_history.max_version)
    if from_ver >= to_ver
      fail ArgumentError, 'from_ver must be less than to_ver'
Severity: Minor
Found in lib/ass_updater.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 [] has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def [](version)
      return [min_version] if version.to_s == '0.0.0.0'
      raw['update'].each do |h|
        next if h['version'] != version.to_s
        h['target'] = [] << h['target'] if h['target'].is_a? String
Severity: Minor
Found in lib/ass_updater/update_history.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