lib/fog/azurerm/requests/network/remove_security_rule.rb
Method remove_security_rule
has 119 lines of code (exceeds 25 allowed). Consider refactoring. Open
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',
Carriage return character detected. Open
Open
module Fog
module Network
- Exclude checks
Use a guard clause instead of wrapping the code inside a conditional expression. Open
Open
unless security_rule_list.nil?
- Read upRead up
- Exclude checks
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
Open
return security_rule_list.select { |sr| sr.name != rule_name }
- Read upRead up
- Exclude checks
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.