whylabs/whylogs-python

View on GitHub

Showing 224 of 3,627 total issues

Function register_metric_udf has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

def register_metric_udf(
    col_name: Optional[str] = None,
    col_type: Optional[DataType] = None,
    submetric_name: Optional[str] = None,
    submetric_schema: Optional[SubmetricSchema] = None,
Severity: Minor
Found in python/whylogs/experimental/core/metrics/udf_metric.py - About 5 hrs to fix

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 columnar_validate has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

    def columnar_validate(self, data: Any, identity_values: Optional[Any] = None) -> None:
        count = 0
        count_failures = 0
        validate_with_row_id = False
        if self.enable_sampling and self._sampler is None:
Severity: Minor
Found in python/whylogs/core/validators/condition_validator.py - About 5 hrs to fix

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_udf_resolvers has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

def generate_udf_resolvers(
    schema_name: Union[str, List[str]] = "",
    include_default_schema: bool = True,
) -> List[ResolverSpec]:
    """
Severity: Minor
Found in python/whylogs/experimental/core/metrics/udf_metric.py - About 4 hrs to fix

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 _flush has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    def _flush(self, results: ResultSet) -> None:
        if results is None:
            logger.debug("The result is None, skipping flush of result set.")
            return
        if results.count == 0:
Severity: Minor
Found in python/whylogs/api/logger/rolling.py - About 4 hrs to fix

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 29 (exceeds 5 allowed). Consider refactoring.
Open

    def apply(data: Any) -> "PreprocessedColumn":
        result = PreprocessedColumn()
        result.original = data
        if pd.Series is not None and isinstance(data, pd.Series):
            result._pandas_split(data)
Severity: Minor
Found in python/whylogs/core/preprocessing.py - About 4 hrs to fix

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_summaries_with_drift_score has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

def generate_summaries_with_drift_score(
    target_view: DatasetProfileView,
    ref_view: Optional[DatasetProfileView],
    config: Optional[SummaryConfig],
    drift_map: Optional[Dict[str, column_drift_algorithms.ColumnDriftAlgorithm]] = None,
Severity: Minor
Found in python/whylogs/viz/utils/profile_viz_calculations.py - About 4 hrs to fix

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 __call__ has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    def __call__(self, x: Any) -> bool:
        if isinstance(x, Metric):
            metric = x
            if self._op != Relation._udf:
                if not self._component:
Severity: Minor
Found in python/whylogs/core/relations.py - About 3 hrs to fix

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_track has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    def _do_track(
        self,
        obj: Any = None,
        *,
        pandas: Optional[pd.DataFrame] = None,
Severity: Minor
Found in python/whylogs/core/dataset_profile.py - About 3 hrs to fix

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 columnar_update has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    def columnar_update(self, view: PreprocessedColumn) -> OperationResult:
        data = (
            view.pandas.strings.to_list() if view.pandas.strings is not None and not view.pandas.strings.empty else []
        )
        data = (data + view.list.strings) if view.list.strings else data
Severity: Minor
Found in python/whylogs/core/metrics/unicode_range.py - About 3 hrs to fix

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 columnar_update has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    def columnar_update(self, view: PreprocessedColumn) -> OperationResult:
        """
        Update the operation

        Algorithm: https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Parallel_algorithm
Severity: Minor
Found in python/whylogs/core/metrics/metrics.py - About 3 hrs to fix

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_scalar_value has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    def _process_scalar_value(value: Any) -> "PreprocessedColumn":
        result = PreprocessedColumn()
        result.original = value
        result.len = 1
        int_list = []
Severity: Minor
Found in python/whylogs/core/preprocessing.py - About 3 hrs to fix

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_summaries has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

def generate_summaries(
    target_view: DatasetProfileView, ref_view: Optional[DatasetProfileView], config: Optional[SummaryConfig]
) -> Optional[Dict[str, Any]]:
    if config is None:
        config = SummaryConfig()
Severity: Minor
Found in python/whylogs/viz/utils/profile_viz_calculations.py - About 3 hrs to fix

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

SessionConfig has 26 functions (exceeds 20 allowed). Consider refactoring.
Open

class SessionConfig:
    def __init__(self, init_config: Optional[InitConfig] = None) -> None:
        self._init_config = init_config or InitConfig()
        self.logger = logging.getLogger("config")
        self._ensure_config_exists = False if self._init_config.force_local is True else True
Severity: Minor
Found in python/whylogs/api/whylabs/session/config.py - About 3 hrs to fix

    Function write has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        def write(self, file: Writable, **kwargs: Any) -> Tuple[bool, str]:
            if isinstance(file, FeatureWeights):
                return self.write_feature_weights(file, **kwargs)
            elif isinstance(file, EstimationResult):
                return self.write_estimation_result(file, **kwargs)
    Severity: Minor
    Found in python/whylogs/api/writer/whylabs.py - About 2 hrs to fix

    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 profile has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        def profile(self, segment: Optional[Segment] = None) -> Optional[Union[DatasetProfile, DatasetProfileView]]:
            if not self._segments:
                return None
            elif segment:
                paritition_segments = self._segments.get(segment.parent_id)
    Severity: Minor
    Found in python/whylogs/api/logger/result_set.py - About 2 hrs to fix

    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

    DatasetProfileView has 25 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class DatasetProfileView(Writable):
        _columns: Dict[str, ColumnProfileView]
    
        def __init__(
            self,
    Severity: Minor
    Found in python/whylogs/core/view/dataset_profile_view.py - About 2 hrs to fix

      Function _pandas_split has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          def _pandas_split(self, series: pd.Series, parse_numeric_string: bool = False) -> None:
              """
              Split a Pandas Series into numpy array and other Pandas series.
      
              Args:
      Severity: Minor
      Found in python/whylogs/core/preprocessing.py - About 2 hrs to fix

      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 columnar_update has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          def columnar_update(self, data: PreprocessedColumn) -> OperationResult:
              if data.len <= 0:
                  return OperationResult.ok(0)
      
              count = 0
      Severity: Minor
      Found in python/whylogs/core/metrics/condition_count_metric.py - About 2 hrs to fix

      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_simple_partition has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

      def _process_simple_partition(
          partition_id: str,
          schema: DatasetSchema,
          segments: Dict[Segment, Any],
          columns: List[str],
      Severity: Minor
      Found in python/whylogs/api/logger/segment_processing.py - About 2 hrs to fix

      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 add_drift_config has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def add_drift_config(
              self, column_names: List[str], algorithm: column_drift_algorithms.ColumnDriftAlgorithm
          ) -> None:
              """Add drift configuration.
              The algorithms and thresholds added through this method will be used to calculate drift scores in the `summary_drift_report()` method.
      Severity: Minor
      Found in python/whylogs/viz/notebook_profile_viz.py - About 2 hrs to fix

      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

      Severity
      Category
      Status
      Source
      Language