gwastro/sbank

View on GitHub

Showing 14 of 69 total issues

Function covers has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    def covers(self, proposal, min_match, nhood=None):
        """
        Return (max_match, template) where max_match is either (i) the
        best found match if max_match < min_match or (ii) the match of
        the first template found with match >= min_match.  template is
Severity: Minor
Found in sbank/bank.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 tau0tau3_bound has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

def tau0tau3_bound(flow, **constraints):
    '''
    For a given set of constraints on the m1-m2 parameter space,
    this function returns the corners of a box which bounds the
    same region (tightly) above and below in tau0-tau3 space.
Severity: Minor
Found in sbank/tau0tau3.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

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

class AlignedSpinTemplate(object):
    """
    Base class that handles whitening, normalization, and
    zero-padding/unpadding. Derived classes should:

Severity: Minor
Found in sbank/waveforms.py - About 2 hrs to fix

    Function set_default_constraints has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def set_default_constraints(constraints):
        '''
        Check that the constraints dict does not containt unknown
        constraints. Check that required constraints are given. To define
        a 2D parameter space, one needs at least three and possibly four
    Severity: Minor
    Found in sbank/tau0tau3.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 aligned_spin_param_generator has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def aligned_spin_param_generator(flow, tmplt_class, bank, **kwargs):
        """
        Specify the min and max mass of the bigger component, the min and
        max mass of the total mass and the min and max values for the
        z-axis spin angular momentum.
    Severity: Minor
    Found in sbank/tau0tau3.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 16 arguments (exceeds 8 allowed). Consider refactoring.
    Open

        def __init__(self, m1, m2, spin1x, spin1y, spin1z, spin2x, spin2y, spin2z,
    Severity: Major
    Found in sbank/waveforms.py - About 1 hr to fix

      Function create_moments has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def create_moments(df, flow, len_PSD):
          # moments go from flow to fmax unlike the PSD, which starts at 0
          n = len_PSD - int(flow / df)
          momI_0 = lal.CreateREAL8Vector(n)
          momI_2 = lal.CreateREAL8Vector(n)
      Severity: Minor
      Found in sbank/waveforms.py - About 1 hr to fix

        Function __init__ has 13 arguments (exceeds 8 allowed). Consider refactoring.
        Open

            def __init__(self, m1, m2, spin1x, spin1y, spin1z,
        Severity: Major
        Found in sbank/waveforms.py - About 1 hr to fix

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

              def __init__(self, *args, **kwargs):
                  llwsit.__init__(self, *args, **kwargs)
                  for entry in _sit_cols.keys():
                      if not hasattr(self, entry):
                          if _sit_cols[entry] in ['real_4', 'real_8']:
          Severity: Minor
          Found in sbank/waveforms.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 allowed_m1m2 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def allowed_m1m2(m1, m2, m1m2_constraints, tol=1e-10):
              '''
              Return those values of m1,m2 from the input arrays
              that are consistent with the specified constraints.
              '''
          Severity: Minor
          Found in sbank/tau0tau3.py - About 45 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 __init__ has 10 arguments (exceeds 8 allowed). Consider refactoring.
          Open

              def __init__(self, noise_model, flow, use_metric=False, cache_waveforms=False, nhood_size=1.0,
          Severity: Major
          Found in sbank/bank.py - About 45 mins to fix

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

            def urand_tau0tau3_generator(flow, **constraints):
                """
                This is a generator for random (m1, m2) pairs that are uniformly
                distributed in (tau0, tau3) space, subject to the constraints given in
                the inputs.
            Severity: Minor
            Found in sbank/tau0tau3.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 add_from_hdf has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def add_from_hdf(self, hdf_fp):
                    num_points = len(hdf_fp['mass1'])
                    newtmplts = []
                    for idx in range(num_points):
                        if not idx % 100000:
            Severity: Minor
            Found in sbank/bank.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 __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def __init__(self, noise_model, flow, use_metric=False, cache_waveforms=False, nhood_size=1.0,
                             nhood_param="tau0", coarse_match_df=None, iterative_match_df_max=None,
                             fhigh_max=None, optimize_flow=None):
                    self.noise_model = noise_model
                    self.flow = flow
            Severity: Minor
            Found in sbank/bank.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

            Severity
            Category
            Status
            Source
            Language