forward3d/cap-ec2

View on GitHub

Showing 2 of 2 total issues

Method load_config has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    def load_config
      if fetch(:ec2_profile)
        credentials = Aws::SharedCredentials.new(profile_name: fetch(:ec2_profile)).credentials
        if credentials
          set :ec2_access_key_id, credentials.access_key_id
Severity: Minor
Found in lib/cap-ec2/utils.rb - About 4 hrs 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 get_servers_for_role has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def get_servers_for_role(role)
      filters = [
        {name: 'tag-key', values: [stages_tag, project_tag]},
        {name: tag(project_tag), values: ["*#{application}*"]},
        {name: 'instance-state-name', values: %w(running)}
Severity: Minor
Found in lib/cap-ec2/ec2-handler.rb - About 35 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