fog/fog-azure-rm

View on GitHub
lib/fog/azurerm/models/network/network_interface.rb

Summary

Maintainability
B
4 hrs
Test Coverage
F
35%

Method parse has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

        def self.parse(nic)
          hash = {}
          hash['id'] = nic.id
          hash['name'] = nic.name
          hash['location'] = nic.location
Severity: Minor
Found in lib/fog/azurerm/models/network/network_interface.rb - About 3 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 parse has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def self.parse(nic)
          hash = {}
          hash['id'] = nic.id
          hash['name'] = nic.name
          hash['location'] = nic.location
Severity: Minor
Found in lib/fog/azurerm/models/network/network_interface.rb - About 1 hr to fix

    Use %i or %I for an array of symbols.
    Open

              restricted_attributes = [:name, :id, :resource_group, :location, :ip_configuration_name, :ip_configuration_id]

    This cop can check for array literals made up of symbols that are not using the %i() syntax.

    Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.

    Configuration option: MinSize If set, arrays with fewer elements than this value will not trigger the cop. For example, a MinSize of3` will not enforce a style on an array of 2 or fewer elements.

    Example: EnforcedStyle: percent (default)

    # good
    %i[foo bar baz]
    
    # bad
    [:foo, :bar, :baz]

    Example: EnforcedStyle: brackets

    # good
    [:foo, :bar, :baz]
    
    # bad
    %i[foo bar baz]

    There are no issues that match your filters.

    Category
    Status