Showing 8 of 12 total issues
File compare.py
has 315 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
File: compare.py
Author: Rob Phoenix
Function _hash_lookup
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def _hash_lookup(self, baseline, comparison):
missing, additional, with_vars = [], [], []
while not baseline.empty():
baseline_group = baseline.get()
baseline_parent = baseline_group[0]
- Read upRead up
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 _with_vars_search
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _with_vars_search(self, with_vars, comparison, missing, additional):
while with_vars:
target = with_vars.pop()
target_parent = target[0]
target_children = sorted(target[1:])
- Read upRead up
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 _ignore_line
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _ignore_line(self, line):
for line_to_ignore in self.ignore_lines:
for metacharacter in diffios.REGEX_METACHARACTERS:
if metacharacter in line_to_ignore:
line_to_ignore = line_to_ignore.replace(
- Read upRead up
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 _child_lookup
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _child_lookup(baseline_parent, baseline_children, comparison_children):
ChildComparison = namedtuple('ChildComparison', 'additional missing')
missing = []
for baseline_child in baseline_children:
if baseline_child not in comparison_children and not missing:
- Read upRead up
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 _binary_search
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _binary_search(self, target, search_array):
if not search_array:
return None
sorted_array = sorted(search_array)
low = 0
- Read upRead up
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 _group_config
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _group_config(self):
current_group, groups = [], []
for line in self._valid_config():
if not line.startswith(' ') and current_group:
groups.append(current_group)
- Read upRead up
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 __init__
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, baseline, comparison, ignore_lines=None):
"""Initialize a diffios.Compare object with a baseline,
a comparison and lines to ignore.
Args:
- Read upRead up
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"