whylabs/whylogs-python

View on GitHub

Showing 3,656 of 3,656 total issues

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

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

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 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 _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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                  propertyPanelData[feature[0]][0] = tempFeatureValues.numberSummary.histogram.counts.reduce(
                    (acc, value, index) => {
                      acc.push({
                        value: value,
                        count: tempFeatureValues.numberSummary.histogram.bins[index],
    Severity: Major
    Found in python/whylogs/viz/html/js/whylogs-script.js and 1 other location - About 2 hrs to fix
    python/whylogs/viz/html/js/whylogs-script.js on lines 1228..1237

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 89.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                referencePropertyPanelData[feature[0]][0] = tempFeatureValues.referenceNumberSummary.histogram.counts.reduce(
                  (acc, value, index) => {
                    acc.push({
                      value: value,
                      count: tempFeatureValues.referenceNumberSummary.histogram.bins[index],
    Severity: Major
    Found in python/whylogs/viz/html/js/whylogs-script.js and 1 other location - About 2 hrs to fix
    python/whylogs/viz/html/js/whylogs-script.js on lines 1201..1210

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 89.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    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

    WhyLabsWriter has 23 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class WhyLabsWriter(Writer):
        f"""
        A WhyLogs writer to upload DatasetProfileView's onto the WhyLabs platform.
    
        >**IMPORTANT**: In order to correctly send your profiles over, make sure you have
    Severity: Minor
    Found in python/whylogs/api/writer/whylabs.py - About 2 hrs to fix

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

            feature[1].quantiles.forEach((quentiles, index) => {
              if (selectedProfiles.includes(String(index))) {
                quentiles.thirdQuantile
                  ? (quantilesThirdQuantileString += `<div>${quentiles.thirdQuantile}</div>`)
                  : (quantilesThirdQuantileString += `<div>-</div>`);
      Severity: Major
      Found in python/whylogs/viz/html/js/whylogs-script.js and 4 other locations - About 2 hrs to fix
      python/whylogs/viz/html/js/whylogs-script.js on lines 857..863
      python/whylogs/viz/html/js/whylogs-script.js on lines 865..871
      python/whylogs/viz/html/js/whylogs-script.js on lines 881..887
      python/whylogs/viz/html/js/whylogs-script.js on lines 889..895

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 84.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

            feature[1].quantiles.forEach((quantiles, index) => {
              if (selectedProfiles.includes(String(index))) {
                quantiles.max
                  ? (quantilesMaxString += `<div>${quantiles.max}</div>`)
                  : (quantilesMaxString += `<div>-</div>`);
      Severity: Major
      Found in python/whylogs/viz/html/js/whylogs-script.js and 4 other locations - About 2 hrs to fix
      python/whylogs/viz/html/js/whylogs-script.js on lines 857..863
      python/whylogs/viz/html/js/whylogs-script.js on lines 865..871
      python/whylogs/viz/html/js/whylogs-script.js on lines 873..879
      python/whylogs/viz/html/js/whylogs-script.js on lines 889..895

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 84.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

            feature[1].quantiles.forEach((quantiles, index) => {
              if (selectedProfiles.includes(String(index))) {
                quantiles.min
                  ? (quantilesMinString += `<div>${quantiles.min}</div>`)
                  : (quantilesMinString += `<div>-</div>`);
      Severity: Major
      Found in python/whylogs/viz/html/js/whylogs-script.js and 4 other locations - About 2 hrs to fix
      python/whylogs/viz/html/js/whylogs-script.js on lines 865..871
      python/whylogs/viz/html/js/whylogs-script.js on lines 873..879
      python/whylogs/viz/html/js/whylogs-script.js on lines 881..887
      python/whylogs/viz/html/js/whylogs-script.js on lines 889..895

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 84.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

            feature[1].quantiles.forEach((quantiles, index) => {
              if (selectedProfiles.includes(String(index))) {
                quantiles.median
                  ? (quantilesMedianString += `<div>${quantiles.median}</div>`)
                  : (quantilesMedianString += `<div>-</div>`);
      Severity: Major
      Found in python/whylogs/viz/html/js/whylogs-script.js and 4 other locations - About 2 hrs to fix
      python/whylogs/viz/html/js/whylogs-script.js on lines 857..863
      python/whylogs/viz/html/js/whylogs-script.js on lines 873..879
      python/whylogs/viz/html/js/whylogs-script.js on lines 881..887
      python/whylogs/viz/html/js/whylogs-script.js on lines 889..895

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 84.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

            feature[1].quantiles.forEach((quantiles, index) => {
              if (selectedProfiles.includes(String(index))) {
                quantiles.firstQuantile
                  ? (quantilesFirsString += `<div>${quantiles.firstQuantile}</div>`)
                  : (quantilesFirsString += `<div>-</div>`);
      Severity: Major
      Found in python/whylogs/viz/html/js/whylogs-script.js and 4 other locations - About 2 hrs to fix
      python/whylogs/viz/html/js/whylogs-script.js on lines 857..863
      python/whylogs/viz/html/js/whylogs-script.js on lines 865..871
      python/whylogs/viz/html/js/whylogs-script.js on lines 873..879
      python/whylogs/viz/html/js/whylogs-script.js on lines 881..887

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 84.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      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/extensions/reports/summary_drift.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 get_writables has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_writables(self) -> Optional[List[Writable]]:
              results: Optional[List[Writable]] = None
              if self._segments:
                  results = []
                  logger.info(f"Building list of: {self.count} SegmentedDatasetProfileViews in SegmentedResultSet.")
      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

      Function _compute_ks_score has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def _compute_ks_score(self, target_distribution, reference_distribution, with_thresholds=False):
              QUANTILES = self._parameter_config.quantiles
              if reference_distribution.is_empty() or target_distribution.is_empty():
                  return None
      
      
      Severity: Minor
      Found in python/whylogs/viz/drift/column_drift_algorithms.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 log_batch_ranking_metrics has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      def log_batch_ranking_metrics(
          data: pd.core.frame.DataFrame,
          prediction_column: Optional[str] = None,
          target_column: Optional[str] = None,
          score_column: Optional[str] = None,
      Severity: Minor
      Found in python/whylogs/experimental/api/logger/__init__.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 _resolve has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def _resolve(self, name: str, why_type: DataType, config: Optional[MetricConfig]) -> Dict[str, Metric]:
              result: Dict[str, Metric] = {}
              for resolver_spec in self._resolvers:
                  col_name, col_type = resolver_spec.column_name, resolver_spec.column_type
                  if col_name == name or (col_name is None and isinstance(why_type, col_type)):  # type: ignore
      Severity: Minor
      Found in python/whylogs/core/resolvers.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 generate_constraints_from_reference_profile has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      def generate_constraints_from_reference_profile(
          reference_profile_view: DatasetProfileView,
          included_columns: Optional[List[str]] = None,
          excluded_columns: Optional[List[str]] = None,
      ) -> List[MetricConstraint]:
      Severity: Minor
      Found in python/whylogs/experimental/constraints_generation/__init__.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