Showing 8 of 38 total issues
Function _process
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def _process(self, root):
"""
The main parsing function
"""
root_type = type(root)
- 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
Parser
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
class Parser:
# default params
default_params = {
'etype': 'fernet',
# list of simpleeval library parameters
File parser.py
has 297 lines of code (exceeds 250 allowed). Consider refactoring. Open
import json
import logging
import os
import collections
import copy
ConffTestCase
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class ConffTestCase(TestCase):
def setUp(self):
super(ConffTestCase, self).setUp()
# set path
current_path = os.path.dirname(os.path.abspath(__file__))
Function test_complex_load_yml
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_complex_load_yml(self):
p = conff.Parser()
fs_path = self.get_test_data_path('test_config_02.yml')
p.generate_crypto_key()
data = p.load(fs_path=fs_path)
Function update_recursive
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def update_recursive(d, u):
"""
Update dictionary recursively. It traverse any object implements
"collections.Mapping", anything else, it overwrites the original value.
:param d: Original dictionary to be updated
- 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 load
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def load(self, fs_path: str, fs_root: str = '', fs_include: list = None):
"""
Parse configuration file on disk.
:param fs_path: The path to the file on disk. If fs_root is specified,
- 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 fn_update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def fn_update(self, update, parent):
def walk(u, p):
tu, tp = type(u), type(p)
if tu in [dict, odict, Munch2] and tp in [dict, odict, Munch2]:
for k, v in u.items():
- 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"