DeepRegNet/DeepReg

View on GitHub

Showing 89 of 113 total issues

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

    def __init__(
Severity: Minor
Found in deepreg/model/layer.py - About 35 mins to fix

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

        def validate_images_and_labels(
    Severity: Minor
    Found in deepreg/dataset/loader/interface.py - About 35 mins to fix

      Function train has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def train(
          gpu: str,
          config_path: Union[str, List[str]],
          ckpt_path: str,
          num_workers: int = 1,
      Severity: Minor
      Found in deepreg/train.py - About 35 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 predict has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def predict(
          gpu: str,
          ckpt_path: str,
          split: str,
          batch_size: int,
      Severity: Minor
      Found in deepreg/predict.py - About 35 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 parse_label_loss has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def parse_label_loss(loss_config: Dict) -> Dict:
          """
          Parse the label loss part in loss configuration.
      
          :param loss_config: potentially outdated config
      Severity: Minor
      Found in deepreg/config/v011.py - About 35 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 main has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def main(args=None):
          """
          CLI for deepreg_vis tool.
      
          Requires ffmpeg wirter to write gif files.
      Severity: Minor
      Found in deepreg/vis.py - About 35 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 set_data_structure has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def set_data_structure(self):
              """
              Store the data structure in  memory so that
              we can retrieve data using data_index.
              This function sets two attributes:
      Severity: Minor
      Found in deepreg/dataset/loader/h5_loader.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 build_from_config has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def build_from_config(
              self, category: str, config: Dict, default_args: Optional[dict] = None
          ) -> Any:
              """
              Build a class instance from config dict.
      Severity: Minor
      Found in deepreg/registry.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 parse_reg_loss has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def parse_reg_loss(loss_config: Dict) -> Dict:
          """
          Parse the regularization loss part in loss configuration.
      
          :param loss_config: potentially outdated config
      Severity: Minor
      Found in deepreg/config/v011.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