yzhao062/Pyod

View on GitHub
pyod/models/dif.py

Summary

Maintainability
C
1 day
Test Coverage

File dif.py has 324 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
"""Deep Isolation Forest for Anomaly Detection (DIF)
"""
# Author: Hongzuo Xu <hongzuoxu@126.edu>
# License: BSD 2 clause
Severity: Minor
Found in pyod/models/dif.py - About 3 hrs to fix

    Function __init__ has 11 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self,
    Severity: Major
    Found in pyod/models/dif.py - About 1 hr to fix

      Function get_in_out_channels has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_in_out_channels(i, num_layers, n_features, n_hidden, n_output,
                                  skip_connection):
              if skip_connection is False:
                  in_channels = n_features if i == 0 else n_hidden[i - 1]
                  out_channels = n_output if i == num_layers else n_hidden[i]
      Severity: Minor
      Found in pyod/models/dif.py - About 1 hr 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 __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self, n_features, n_hidden=[500, 100], n_output=20,
      Severity: Major
      Found in pyod/models/dif.py - About 50 mins to fix

        Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(self, in_channels, out_channels,
        Severity: Minor
        Found in pyod/models/dif.py - About 45 mins to fix

          Function get_in_out_channels has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def get_in_out_channels(i, num_layers, n_features, n_hidden, n_output,
          Severity: Minor
          Found in pyod/models/dif.py - About 35 mins to fix

            Function fit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def fit(self, X, y=None):
                    """Fit detector. y is ignored in unsupervised methods.
            
                    Parameters
                    ----------
            Severity: Minor
            Found in pyod/models/dif.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

            There are no issues that match your filters.

            Category
            Status