dvc/render/converter/vega.py
File vega.py
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import os
from collections.abc import Iterable
from typing import Any, Optional, Union
from funcy import first, last
Function _infer_x_y
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
def _infer_x_y(self):
x = self.properties.get("x", None)
y = self.properties.get("y", None)
inferred_properties: dict = {}
- 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 deeply nested control flow statements. Open
Open
for field in val:
yield file, field
Avoid too many return
statements within this function. Open
Open
return first(fields)
Avoid too many return
statements within this function. Open
Open
return "y"
Function _infer_y_from_data
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def _infer_y_from_data(self):
if self.plot_id in self.data:
for lst in _lists(self.data[self.plot_id]):
if all(isinstance(item, dict) for item in lst):
datapoint = first(lst)
- 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"