jaesivsm/MindYourNeighbors

View on GitHub
src/mind_your_neighbors/main.py

Summary

Maintainability
B
6 hrs
Test Coverage

Function browse_config has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

def browse_config(config, cache):
    """Will browse all section of the config,
    fill cache and launch command when needed.
    """
    commands.ip_neigh.cache_clear()
Severity: Minor
Found in src/mind_your_neighbors/main.py - About 2 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

Function logging_results has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def logging_results(addr_by_mac, known_machines):
    """Will fire several logging message with levels depending on matching
    status"""
    rev_machine = {mac: name for name, mac in known_machines.items()} \
            if known_machines else {}
Severity: Minor
Found in src/mind_your_neighbors/main.py - About 2 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

Function check_neighborhood has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

def check_neighborhood(neighbors, filter_on_regex=None, filter_out_regex=None,
Severity: Major
Found in src/mind_your_neighbors/main.py - About 50 mins to fix

    Function check_neighborhood has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def check_neighborhood(neighbors, filter_on_regex=None, filter_out_regex=None,
                           filter_on_machines=None, filter_out_machines=None,
                           exclude=None, known_machines=None):
        """Will execute *ip neigh* unless the result of the command has been
        cached. Will then compile a specific regex for the given parameters and
    Severity: Minor
    Found in src/mind_your_neighbors/main.py - 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

    Function process_filters has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def process_filters(filter_on_regex, filter_out_regex, exclude,
    Severity: Minor
    Found in src/mind_your_neighbors/main.py - About 45 mins to fix

      There are no issues that match your filters.

      Category
      Status