Showing 37 of 37 total issues
DSLTransformer
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class DSLTransformer(Transformer):
def expression(self, items):
return items[0]
def and_expression(self, items):
Function build
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def build(specification: Optional[Specification] = None) -> Optional[Collection]:
if specification is None:
return None
elif isinstance(specification, EmptySpecification):
return None
- 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 build
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def build(specification: Optional[Specification] = None) -> Optional[Collection]:
if specification is None:
return None
elif isinstance(specification, EmptySpecification):
return None
- 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 build
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def build(specification: Optional[Specification] = None) -> Optional[dict]:
if specification is None:
return None
elif isinstance(specification, EmptySpecification):
return None
- 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 dump_dsl
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def dump_dsl(self) -> Optional[str]:
from fractal_specifications.generic import collections, operators
if isinstance(self, operators.NotSpecification):
child = self.specification.dump_dsl()
- 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 build
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def build(
cls,
specification: Optional[Specification] = None,
*,
return_mask=False,
- 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 comparison_expression
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def comparison_expression(self, items):
from fractal_specifications.generic.specification import Specification
if issubclass(type(items[0]), Specification):
return items[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
Avoid too many return
statements within this function. Open
return GreaterThanSpecification(field_name, value)
Avoid too many return
statements within this function. Open
return {specification.field: {"$gt": specification.value}}
Avoid too many return
statements within this function. Open
return {specification.field: {"$eq": specification.value}}
Avoid too many return
statements within this function. Open
return specification.field, ">=", specification.value
Avoid too many return
statements within this function. Open
return LessThanEqualSpecification(field_name, value)
Avoid too many return
statements within this function. Open
return {
Avoid too many return
statements within this function. Open
return specification.field, "in", specification.value
Avoid too many return
statements within this function. Open
return {"match": {"%s.keyword" % specification.field: specification.value}}
Avoid too many return
statements within this function. Open
return {specification.field: specification.value}
Avoid too many return
statements within this function. Open
return {
Avoid too many return
statements within this function. Open
return specification.field, "<", specification.value
Avoid too many return
statements within this function. Open
return {
Avoid too many return
statements within this function. Open
return {specification.field: {"$lte": specification.value}}