Showing 236 of 3,918 total issues
Function _drop_non_output_columns
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _drop_non_output_columns(result: SegmentedResultSet, keep_columns: Set[str]) -> SegmentedResultSet:
for partition in result._segments.values():
for segment in partition.values():
for column in {column for column in segment._columns.keys() if column not in keep_columns}:
segment._columns.pop(column)
- 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 feature_statistics
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def feature_statistics(
self, feature_name: Union[str, List[str]], profile: str = "reference", cell_height: Optional[str] = None
) -> HTML:
"""
Generate a report for the main statistics of specified feature, for a given profile (target or reference).
- 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 __post_init__
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __post_init__(self):
if self.column_type is not None:
if self.column_names:
raise ValueError("UdfSpec cannot specify both column_names and column_type")
elif self.column_names is 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 rename_kwargs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def rename_kwargs(func_name: str, kwargs: Dict[str, Any], aliases: Dict[str, str]) -> None:
for alias, new in aliases.items():
if alias in kwargs:
if new in kwargs:
raise TypeError(
- 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 _tag_custom_perf_metrics
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _tag_custom_perf_metrics(
self, view: Union[DatasetProfile, DatasetProfileView, SegmentedDatasetProfileView, ResultSet]
) -> None:
column_names = _get_column_names(view)
for column_name in column_names:
- 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 register_dataset_udf
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def register_dataset_udf(
col_names: List[str],
udf_name: Optional[str] = None,
metrics: Optional[List[MetricSpec]] = None,
namespace: Optional[str] = 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 get_result_set
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_result_set(self, dataset_timestamp: Optional[datetime]) -> SegmentedResultSet:
segmented_profiles: Dict[str, Dict[Segment, DatasetProfile]] = dict()
for segment_key in self._cache:
segments = segmented_profiles.get(segment_key.parent_id)
if segments is 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
Method resolve
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@Override
public HashMap<String, Metric<?>> resolve(ColumnSchema schema) {
HashMap<String, Metric<?>> resolvedMetrics = new HashMap<>();
if (DataTypes.Integral.includes(schema.getType())) {
- 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_protobuf
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def to_protobuf(self) -> ColumnMessage:
res: Dict[str, MetricComponentMessage] = {}
for m_name, m in self._metrics.items():
for mc_name, mc in m.to_protobuf().metric_components.items():
if not m.exclude_from_serialization:
- 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 column_has_non_zero_types
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def column_has_non_zero_types(column_name: str, types_list: List[str]) -> MetricConstraint:
def has_non_zero_types(x) -> bool:
types_dict = x.to_summary_dict()
for key in types_dict.keys():
if key in types_list and types_dict[key] == 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 len
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def len(self) -> int:
length = 0
if self.ints is not None:
length += len(self.ints)
if self.floats is not 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 _merge_CM
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _merge_CM(old_conf_matrix: ConfusionMatrix, new_conf_matrix: ConfusionMatrix):
"""
Merges two confusion_matrix since distinc or overlaping labels
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"
Further reading
Function to_protobuf
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def to_protobuf(self) -> MetricMessage:
msg = {}
for sub_name, metrics in self.submetrics.items():
for namespace, metric in metrics.items():
sub_msg = metric.to_protobuf()
- 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 apply
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def apply(self, profile: DatasetProfileView) -> List[Metric]:
if self.metrics_resolver is not None:
custom_result = self.metrics_resolver(profile)
if isinstance(custom_result, List):
return custom_result
- 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 _do_write
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _do_write(self, out_f: BinaryIO, **kwargs: Any) -> Tuple[bool, str]:
if kwargs.get("use_v0") or self.profile_view.model_performance_metrics:
if self.profile_view.model_performance_metrics:
logger.info("Converting segmented profile with performance metrics to v0 format before writing.")
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 _do_submetric_merge
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _do_submetric_merge(lhs: Dict[str, Metric], rhs: Dict[str, Metric]) -> Dict[str, Metric]:
namespaces = set(lhs.keys())
namespaces.update(rhs.keys())
result: Dict[str, Metric] = {}
for namespace in namespaces:
- 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"