unclesp1d3r/CipherSwarm

View on GitHub
app/models/cracker_binary.rb

Summary

Maintainability
A
2 hrs
Test Coverage
A
97%

Method check_for_newer has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def check_for_newer(operating_system_name, version_string)
      # Convert the version string to a semantic version.
      sem_version = CrackerBinary.to_semantic_version(version_string)

      # Return nil if the version string is invalid.
Severity: Minor
Found in app/models/cracker_binary.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

Avoid too many return statements within this method.
Open

      return patch_match.first if patch_match.first.patch_version > sem_version.patch
Severity: Major
Found in app/models/cracker_binary.rb - About 30 mins to fix

Avoid too many return statements within this method.
Open

      return nil if patch_match.empty?
Severity: Major
Found in app/models/cracker_binary.rb - About 30 mins to fix

Avoid too many return statements within this method.
Open

      return nil if latest.nil?
Severity: Major
Found in app/models/cracker_binary.rb - About 30 mins to fix

There are no issues that match your filters.

Category
Status