joonty/pessimize

View on GitHub

Showing 2 of 9 total issues

Method call has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def call(gems, versions, version_constraint)
      gems.each do |gem|
        if versions.has_key? gem.name
          version = versions[gem.name]
          if !::Gem::Version.new(version).prerelease?
Severity: Minor
Found in lib/pessimize/version_mapper.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 parse_gems_from_tokens! has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def parse_gems_from_tokens!
      enum = tokens.each_with_index

      loop do
        (tok, i) = enum.next
Severity: Minor
Found in lib/pessimize/gemfile.rb - About 55 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