ama-team/cookbook-linux-user-management

View on GitHub

Showing 9 of 26 total issues

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

          def eql?(other)
            return false unless other.is_a?(self.class) || is_a?(other.class)
            return false unless other.instance_variables == instance_variables
            instance_variables.each do |variable|
              value = other.instance_variable_get(variable)
Severity: Minor
Found in files/default/lib/mixin/entity.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 process_public_keys has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

          def process_public_keys(current_state, desired_state)
            return [] if desired_state.nil? && !current_state.policy.remove?
            account = desired_state || current_state
            current_keys = current_state ? current_state.public_keys : {}
            desired_keys = desired_state ? desired_state.public_keys : {}
Severity: Minor
Found in files/default/lib/planner/account.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

Method process_private_keys has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

          def process_private_keys(current_state, desired_state)
            return [] if desired_state.nil? && !current_state.policy.remove?
            account = desired_state || current_state
            current_keys = current_state ? current_state.private_keys : {}
            desired_keys = desired_state ? desired_state.private_keys : {}
Severity: Minor
Found in files/default/lib/planner/account.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

Method privilege_actions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

          def privilege_actions(current_state, desired_state)
            return [] if desired_state.nil? && !current_state.policy.remove?
            group = desired_state || current_state
            current = current_state.nil? ? {} : current_state.privileges
            desired = desired_state.nil? ? {} : desired_state.privileges
Severity: Minor
Found in files/default/lib/planner/group.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

Method process_privileges has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

          def process_privileges(current_state, desired_state)
            return [] if desired_state.nil? && !current_state.policy.remove?
            account = desired_state || current_state
            current_privileges = current_state ? current_state.privileges : {}
            desired_privileges = desired_state ? desired_state.privileges : {}
Severity: Minor
Found in files/default/lib/planner/account.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

Method process has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

            def process(account, current_state, desired_state)
              current_remotes = current_state ? current_state.remotes : {}
              desired_remotes = desired_state ? desired_state.remotes : {}
              key = desired_state || current_state
              actions = @remote.plan(
Severity: Minor
Found in files/default/lib/planner/account/private_key.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

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

          def process_partition(state, partition, clients)
            unless partition.policy.group == Model::Policy::NONE
              state.groups[partition.id] = extract_group(partition)
            end
            clients.values.each do |client|
Severity: Minor
Found in files/default/lib/state/builder.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 contains has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

            def contains(path)
              cursor = @root
              path.each do |segment|
                return false unless cursor.respond_to?(:key?)
                candidates = [segment.to_s, segment.to_sym]
Severity: Minor
Found in files/default/lib/model/client/role_tree.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 extract_account has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def extract_account(client, partition)
            account = Model::Account.new(client.id)
            account.policy = partition.policy.account
            unless client.public_keys.empty?
              account.public_keys!(client.id).merge!(client.public_keys)
Severity: Minor
Found in files/default/lib/state/builder.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