Showing 236 of 3,918 total issues
Function _validate_timestamp
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _validate_timestamp(timestamp: Union[date, datetime, pd.Timestamp, str]) -> datetime:
if isinstance(timestamp, pd.Timestamp):
return timestamp.to_pydatetime()
if isinstance(timestamp, str):
try:
- 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 _histogram_from_sketch
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _histogram_from_sketch(
sketch: kll_doubles_sketch,
max_buckets: Optional[int] = None,
avg_per_bucket: Optional[float] = None,
min_n_buckets: Optional[int] = 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 _wait_result
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _wait_result(future: "Future[T]", timeout: Optional[float] = None) -> T:
"""
Wait on a future with an optional timeout without side effects. This won't update
the status of the future for errors/timeouts.
"""
- 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_pil_exif_metadata
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_pil_exif_metadata(img: ImageType) -> Dict:
"""
Grab EXIF metadata from image
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 relevant_counter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def relevant_counter(self, row: pd.core.series.Series, k: int) -> int:
if self.convert_non_numeric:
return sum(
[1 if pred_val in row[self.target_column] else 0 for pred_val in row[self.prediction_column][:k]]
)
- 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 sum_gains
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def sum_gains(self, row: pd.core.series.Series, k: int) -> int:
if self.convert_non_numeric:
return sum(
[1 if pred_val in row[self.target_column] else 0 for pred_val in row[self.prediction_column][:k]]
)
- 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 unregister_udf
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def unregister_udf(udf_name: str, namespace: Optional[str] = None, schema_name: str = "") -> None:
global _multicolumn_udfs, _resolver_specs
name = f"{namespace}.{udf_name}" if namespace else udf_name
if schema_name not in _multicolumn_udfs:
logger.warn(f"Can't unregister UDF {name} from non-existant schema {schema_name}")
- 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_user_choice
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _get_user_choice(prompt: str, options: List[str]) -> int:
il.question(prompt, ignore_suppress=True)
for i, option in enumerate(options, 1):
il.option(f"{i}. {option}", ignore_suppress=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"
Further reading
Method getMetricComponentPaths
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public List<String> getMetricComponentPaths() {
ArrayList<String> paths = new ArrayList<>();
for (String metricName : this.getMetricNames()) {
Optional<Metric<?>> metric = this.getMetric(metricName);
if (metric.isPresent()) {
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def write(
self,
file: _Writable,
dest: Optional[str] = None,
**kwargs: Any,
- 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_batch
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process_batch(self, batch: List[LoggerMessage], batch_type: Type[LoggerMessage]) -> None:
if batch_type == TrackMessage:
self._process_track_messages(cast(List[TrackMessage], batch))
elif batch_type == FlushMessage:
self._process_flush_messages(cast(List[FlushMessage], batch))
- 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 resolve
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def resolve(self, name: str, why_type: DataType, fi_disabled: bool = False) -> Dict[str, Metric]:
metrics: Dict[str, Metric] = {
"counts": StandardMetric.counts.zero(MetricConfig()),
"types": StandardMetric.types.zero(MetricConfig()),
"cardinality": StandardMetric.cardinality.zero(MetricConfig()),
- 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 set_explicit_names
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_explicit_names(self, key_names: List[str] = []) -> None:
if self.col_names:
for name in key_names:
if name in self.col_names:
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
Method toSummaryDict
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public HashMap<String, Object> toSummaryDict(
Optional<String> columnMetric, Optional<SummaryConfig> config) throws UnsupportedError {
SummaryConfig summaryConfig = config.orElse(new SummaryConfig());
HashMap<String, Object> summary = new HashMap<>();
- 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 wait_result_while
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def wait_result_while(future: "Future[T]", predicate: Callable[[], bool]) -> T:
"""
Wait on a future while the condition is true.
"""
try:
- 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 truncate_time_ms
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def truncate_time_ms(t: int, granularity: TimeGranularity) -> int:
dt = datetime.fromtimestamp(t / 1000, tz=tz.tzutc()).replace(second=0, microsecond=0)
if granularity == TimeGranularity.Minute:
trunc = dt
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
@Override
public T merge(T lhs, T rhs) throws UnsupportedError {
if (lhs instanceof Double) {
Double result = lhs.doubleValue() + rhs.doubleValue();
return (T) 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 _tag_custom_output_metrics
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _tag_custom_output_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 generate_column_distribution_constraints
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def generate_column_distribution_constraints(
column_name: str, column_profile: ColumnProfileView
) -> List[MetricConstraint]:
"""Generates constraints for the count metrics of a column.
Parameters
- 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 zero_padding_frequent_items
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def zero_padding_frequent_items(
target_feature_items: List[FrequentItemEstimate], reference_feature_items: List[FrequentItemEstimate]
) -> Tuple[List[FrequentItemEstimate], List[FrequentItemEstimate]]:
"""Fills estimate value of item with 0 when such item is present in the other profile but absent in the current profile.
This is done for both profiles passed.
- 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"