fog/fog-azure-rm

View on GitHub
lib/fog/azurerm/requests/network/remove_security_rule.rb

Summary

Maintainability
B
4 hrs
Test Coverage
F
36%

Method remove_security_rule has 119 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def remove_security_rule(resource_group_name, security_group_name, _security_rule_name)
          network_security_group = {
            'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/networkSecurityGroups/#{name}",
            'name' => security_group_name,
            'type' => 'Microsoft.Network/networkSecurityGroups',
Severity: Major
Found in lib/fog/azurerm/requests/network/remove_security_rule.rb - About 4 hrs to fix

    Carriage return character detected.
    Open

    module Fog
      module Network

    Use a guard clause instead of wrapping the code inside a conditional expression.
    Open

              unless security_rule_list.nil?

    Use a guard clause instead of wrapping the code inside a conditional expression

    Example:

    # bad
    def test
      if something
        work
      end
    end
    
    # good
    def test
      return unless something
      work
    end
    
    # also good
    def test
      work if something
    end
    
    # bad
    if something
      raise 'exception'
    else
      ok
    end
    
    # good
    raise 'exception' if something
    ok

    Redundant return detected.
    Open

                return security_rule_list.select { |sr| sr.name != rule_name }

    This cop checks for redundant return expressions.

    Example:

    def test
      return something
    end
    
    def test
      one
      two
      three
      return something
    end

    It should be extended to handle methods whose body is if/else or a case expression with a default branch.

    There are no issues that match your filters.

    Category
    Status