Showing 230 of 3,856 total issues
Function relation
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def relation(op: Relation, value: Union[str, int, float]) -> Callable[[Any], bool]: # type: ignore
if op == Relation.match: # type: ignore
return lambda x: re.compile(value).match(x) # type: ignore
if op == Relation.fullmatch: # type: ignore
return lambda x: re.compile(value).fullmatch(x) # type: ignore
- 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
if isinstance(arr, pd.Series):
first = welford_online_variance_m2(existing=first, new_value=arr.iloc[0])
else:
first = welford_online_variance_m2(existing=first, new_value=arr[0])
Function column_is_nullable_datatype
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def column_is_nullable_datatype(column_name: str, datatype: str) -> MetricConstraint:
"""Check if column contains only records of specific datatype.
Datatypes can be: integral, fractional, boolean, string, object.
Returns True if there is at least one record of type datatype and there is no records of remaining types.
- 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
Consider simplifying this complex logical expression. Open
if col_name == name or (col_name is None and isinstance(why_type, col_type)): # type: ignore
for spec in resolver_spec.metrics:
cfg = spec.config or self._default_config or config or MetricConfig()
if self._allowed_metric(name, why_type, cfg, spec.metric):
if spec.metric.get_namespace() in result:
Function write
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def write(
self, path: Optional[str] = None, filename: Optional[str] = None, **kwargs: Any
) -> Tuple[bool, Union[str, List[str]]]:
file_to_write = kwargs.get("file")
if file_to_write 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 _get_segments
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _get_segments(self, reference_results: SegmentedResultSet, target_results: SegmentedResultSet):
if len(reference_results.partitions) > 1 and len(target_results.partitions) > 1:
logger.warning("More than one partition found. Only the first partition will be used for the estimation.")
if len(reference_results.partitions) != len(target_results.partitions):
raise ValueError("The number of partitions in the reference and target results must be the same.")
- 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 __init__
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, resolvers: List[ResolverSpec], default_config: Optional[MetricConfig] = None) -> None:
super().__init__(resolvers, default_config)
for resolver in resolvers:
for metric_spec in resolver.metrics:
if issubclass(metric_spec.metric, MultiMetric) and not resolver.exclude:
- 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 whylogs_pandas_segmented_profiler
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def whylogs_pandas_segmented_profiler(
pdf_iterator: Iterable[pd.DataFrame], schema: Optional[DatasetSchema] = None
) -> Iterable[pd.DataFrame]:
if schema is None or not schema.segments:
raise ValueError(
- 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 _process_flush_message
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _process_flush_message(self, message: FlushMessage) -> None:
for dataset_timestamp, container in self._cache.items():
self._logger.debug(f"Generating result set for dataset timestamp {dataset_timestamp}")
result_set = container.to_result_set()
- 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_cardinality_estimate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_cardinality_estimate(column_profile: ColumnProfileView) -> CardinalityEstimate:
cardinality = column_profile.get_metric("cardinality")
counts = column_profile.get_metric("counts")
est_value: Optional[float] = None
est_ratio: Optional[float] = 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 generate_profile_summary
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def generate_profile_summary(
target_view: DatasetProfileView, config: Optional[SummaryConfig]
) -> Optional[Dict[str, Any]]:
if config is None:
config = SummaryConfig()
- 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 7 (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 _log_segment
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _log_segment(
partition: SegmentationPartition,
schema: DatasetSchema,
obj: Any = None,
pandas: Optional[pd.DataFrame] = 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 write
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def write(
self, file: Writable, dest: Optional[str] = None, **kwargs: Any
) -> Tuple[bool, Union[str, List[Tuple[bool, str]]]]:
self._whylabs_client = self._whylabs_client.option(**kwargs) # type: ignore
if isinstance(file, FeatureWeights):
- 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 _calculate_descriptive_statistics
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _calculate_descriptive_statistics(
column_view: Union[ColumnProfileView, None]
) -> Union[None, DescriptiveStatistics]:
if column_view is None:
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
Method doTrack
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private void doTrack(HashMap<String, ?> row) {
boolean dirty = this.schema.resolve(row);
if (dirty) {
Set<String> schemaColumnNames = this.schema.getColNames();
Set<String> newColumnNames = new HashSet<>();
- 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 merge
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public ColumnProfileView merge(ColumnProfileView otherView) {
if (otherView == null) {
// TODO: log warning that otehrwas null and this returns original
return this;
}
- 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
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get(name: str, writable: Optional[Writable] = None, **kwargs) -> Union[Writer, WriterWrapper]:
if name == "local":
from whylogs.api.writer.local import LocalWriter
writer = LocalWriter(**kwargs) # type: ignore
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def __post_init__(self):
if self.column_name and self.column_type:
logger.warning(f"ResolverSpec: column {self.column_name} also specified type, name takes precedence")
if not (self.column_name or self.column_type):
raise ValueError("ResolverSpec: resolver specification must supply name or type")
- 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 _write_segmented_result_set
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _write_segmented_result_set(self, file: SegmentedResultSet, **kwargs: Any) -> Tuple[bool, str]:
views = file.get_writables()
if not views:
logger.warning("Attempt to write a result set with no writables, nothing written!")
return True, ""
- 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"