ickc/python-coscon

View on GitHub

Showing 36 of 36 total issues

File toast_helper.py has 999 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from __future__ import annotations

from dataclasses import dataclass
from functools import cached_property
from logging import getLogger
Severity: Major
Found in src/coscon/toast_helper.py - About 2 days to fix

    File util.py has 601 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    from __future__ import annotations
    
    from typing import TYPE_CHECKING
    
    import numpy as np
    Severity: Major
    Found in src/coscon/util.py - About 1 day to fix

      Function _exec_mpi has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
      Open

          def _exec_mpi(
              self,
              data: toast.dist.Data,
              signal_name: str,
              debug: bool = False,
      Severity: Minor
      Found in src/coscon/toast_extras.py - About 1 day 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

      File cmb.py has 515 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      from __future__ import annotations
      
      import io
      from collections import defaultdict
      from dataclasses import dataclass
      Severity: Major
      Found in src/coscon/cmb.py - About 1 day to fix

        Function plot has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
        Open

            def plot(
                self,
                x_min: Optional[float] = None,
                x_max: Optional[float] = None,
                y_min: Optional[float] = None,
        Severity: Minor
        Found in src/coscon/toast_helper.py - About 6 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 reorder_TB has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

            def reorder_TB(
                self,
                pixels: List[int],
                TB_anti_alignment: bool = False,
                TB_alternate_anti_alignment: bool = False,
        Severity: Minor
        Found in src/coscon/toast_helper.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

        Function dumper has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

        def dumper(
            data: dict,
            path: Union[Path, str],
            overwrite: bool = False,
            compress: bool = None
        Severity: Minor
        Found in src/coscon/io_helper.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 from_class has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            def from_class(
                cls,
                path: Optional[Path] = None,
                url: Optional[str] = None,
                camb: bool = True,
        Severity: Minor
        Found in src/coscon/cmb.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 rotate_power_spectra_matrix has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

        def rotate_power_spectra_matrix(array: np.ndarray[np.float_], theta: float) -> np.ndarray[np.float_]:
            """Rotate power-spectra in matrix representation assuming TEB-order and angle in radian.
            """
            n_b = array.shape[2]
        
        
        Severity: Minor
        Found in src/coscon/util.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 from_dataframe has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def from_dataframe(cls, df: pd.DataFrame, validate_schema=True):
                """Create Hardware from a dataframe representation
                """
                data: Dict[str, Dict[str, Dict[str, Any]]] = {}
                # all List[str] are pair of names/keys
        Severity: Minor
        Found in src/coscon/toast_helper.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 _exec_serial has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def _exec_serial(
                self,
                data: toast.dist.Data,
                signal_name: str,
                debug: bool = False,
        Severity: Minor
        Found in src/coscon/toast_extras.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 _simmap_planck2018 has 12 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def _simmap_planck2018(
        Severity: Major
        Found in src/coscon/cmb.py - About 1 hr to fix

          Function write has 10 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def write(
          Severity: Major
          Found in src/coscon/cmb.py - About 1 hr to fix

            Function plot has 10 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def plot(
            Severity: Major
            Found in src/coscon/toast_helper.py - About 1 hr to fix

              Function fake_focalplane has 9 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def fake_focalplane(
              Severity: Major
              Found in src/coscon/toast_helper.py - About 1 hr to fix

                Function compare_plot has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def compare_plot(
                        self,
                        *others: PowerSpectra,
                        show: bool = True,
                        relative: bool = False,
                Severity: Minor
                Found in src/coscon/cmb.py - About 55 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 joshian_matrix has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                def joshian_matrix(n, nearest, next_nearest, floor):
                    """generate a matrix based on Josh's simple assumption
                    """
                    res = np.empty((n, n), dtype=np.float64)
                    for i in range(n):
                Severity: Minor
                Found in src/coscon/util.py - About 55 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 Z_tot_i has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def Z_tot_i(
                Severity: Minor
                Found in src/coscon/util.py - About 45 mins to fix

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

                  def Z_tot_norm_sq_i(
                  Severity: Minor
                  Found in src/coscon/util.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        for b in range(n_b):
                                            res[i, j, b] += R_ik * R_jl * array[k, l, b]
                        return res
                    Severity: Major
                    Found in src/coscon/util.py - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language