whylabs/whylogs-python

View on GitHub

Showing 3,918 of 3,918 total issues

DatasetProfileView has 28 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 3 hrs to fix

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

          def _track_segments(self, data: TrackData) -> None:
              if self._schema is None:
                  raise Exception("Schema missing in logger while using segments")
      
              if not isinstance(self._target, SegmentCache):

      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

                  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

      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

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

      class DatasetProfile(_Writable):
          """
          Dataset profile represents a collection of in-memory profiling stats for a dataset.
      
          Args:
      Severity: Minor
      Found in python/whylogs/core/dataset_profile.py - About 2 hrs to fix

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

        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