whylabs/whylogs-python

View on GitHub

Showing 3,856 of 3,856 total issues

Avoid too many return statements within this function.
Open

        return result
Severity: Major
Found in python/whylogs/core/preprocessing.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return lambda x: x <= value  # type: ignore
    Severity: Major
    Found in python/whylogs/core/metrics/condition_count_metric.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return
      Severity: Major
      Found in python/whylogs/core/preprocessing.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return x <= value
        Severity: Major
        Found in python/whylogs/core/relations.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return lambda x: x > value  # type: ignore
          Severity: Major
          Found in python/whylogs/core/metrics/condition_count_metric.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                            return result
            Severity: Major
            Found in python/whylogs/core/preprocessing.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return Predicate(Relation._and, left=left, right=right, component=left._component), i
              Severity: Major
              Found in python/whylogs/core/predicate_parser.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return PreprocessedColumn.apply(list_format)
                Severity: Major
                Found in python/whylogs/core/preprocessing.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return False
                  Severity: Major
                  Found in python/whylogs/core/datatypes.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return x != value
                    Severity: Major
                    Found in python/whylogs/core/relations.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return not self._right(metric or x)  # type: ignore
                      Severity: Major
                      Found in python/whylogs/core/relations.py - About 30 mins to fix

                        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())) {
                        Severity: Minor
                        Found in java/core/src/main/java/com/whylogs/core/resolvers/StandardResolver.java - About 25 mins 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 is_k_item_relevant has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def is_k_item_relevant(self, row: pd.core.series.Series, k: int) -> int:
                                if self.convert_non_numeric:
                                    return 1 if row[self.prediction_column][k - 1] in row[self.target_column] else 0
                                else:
                                    index_ki = row[self.prediction_column].index(k)
                        Severity: Minor
                        Found in python/whylogs/experimental/api/logger/__init__.py - About 25 mins 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 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,
                        Severity: Minor
                        Found in python/whylogs/experimental/core/udf_schema.py - About 25 mins 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

                        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;

                        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
                        Severity: Minor
                        Found in python/whylogs/api/logger/experimental/logger/actor/time_util.py - About 25 mins 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 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:
                        Severity: Minor
                        Found in python/whylogs/api/logger/segment_cache.py - About 25 mins 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 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]]
                                    )
                        Severity: Minor
                        Found in python/whylogs/experimental/api/logger/__init__.py - About 25 mins 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 _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)
                        Severity: Minor
                        Found in python/whylogs/experimental/api/logger/__init__.py - About 25 mins 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_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))

                        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