File pydsl.py
has 330 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
'''
:maintainer: Jack Kuan <kjkuan@gmail.com>
:maturity: new
:platform: all
Function include
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def include(self, *sls_names, **kws):
if 'env' in kws:
# "env" is not supported; Use "saltenv".
kws.pop('env')
- 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 __call__
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def __call__(self, check=True):
sls = Sls.get_render_stack()[-1]
if self._id in sls.get_all_decls():
last_func = sls.last_func()
if last_func and self._mods[-1]._func is not last_func:
- 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_highstate
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def load_highstate(self, highstate):
for sid, decl in six.iteritems(highstate):
s = self.state(sid)
for modname, args in six.iteritems(decl):
if '.' in modname:
- 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 __getattr__
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def __getattr__(self, name):
if self._func:
if name == self._func.name:
return self._func
else:
- 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 to_highstate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def to_highstate(self, slsmod):
# generate a state that uses the stateconf.set state, which
# is a no-op state, to hold a reference to the sls module
# containing the DSL statements. This is to prevent the module
# from being GC'ed, so that objects defined in it will be
- 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 extend
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def extend(self, *state_funcs):
if self.options.ordered or self.last_func():
raise PyDslError(
'Cannot extend() after the ordered option was turned on!'
)
- 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
Avoid too many return
statements within this function. Open
return f