DeepRegNet/DeepReg

View on GitHub

Showing 113 of 113 total issues

Function remove_prefix_suffix has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def remove_prefix_suffix(
    x: str, prefix: Union[str, List[str]], suffix: Union[str, List[str]]
) -> str:
    """
    Remove the prefix and suffix from a string,
Severity: Minor
Found in deepreg/dataset/loader/util.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

Avoid deeply nested control flow statements.
Open

                    if case in file:
                        os.chdir(os.path.join(path_to_train, folder))
                        source = file
                        destination = os.path.join(path_to_test, folder)
                        shutil.move(source, destination)
Severity: Major
Found in demos/unpaired_ct_lung/demo_data.py - About 45 mins to fix

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

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

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

          def register(
      Severity: Minor
      Found in deepreg/registry.py - About 35 mins to fix

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

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

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

          def tile_slices(img_paths, save_path="", fname=None, slice_inds=None, col_titles=None):
          Severity: Minor
          Found in deepreg/vis.py - About 35 mins to fix

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

            def build_dataset(
            Severity: Minor
            Found in deepreg/util.py - About 35 mins to fix

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

              def train_step(grid, weights, optimizer, mov, fix) -> object:
              Severity: Minor
              Found in demos/classical_ct_headneck_affine/demo_register.py - About 35 mins to fix

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

                def build_checkpoint_callback(
                Severity: Minor
                Found in deepreg/callback.py - About 35 mins to fix

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

                  def gif_tile_slices(img_paths, save_path=None, size=(2, 2), fname=None, interval=50):
                  Severity: Minor
                  Found in deepreg/vis.py - About 35 mins to fix

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

                        def build_output_block(
                    Severity: Minor
                    Found in deepreg/model/backbone/u_net.py - About 35 mins to fix

                      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 build_output_block has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def build_output_block(
                        Severity: Minor
                        Found in deepreg/model/backbone/global_net.py - About 35 mins to fix

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

                          def move_files_into_correct_path(
                          Severity: Minor
                          Found in demos/unpaired_ct_lung/demo_data.py - About 35 mins to fix

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

                            def gen_rand_ddf(
                            Severity: Minor
                            Found in deepreg/dataset/preprocess.py - About 35 mins to fix

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

                                  def build_output_block(
                              Severity: Minor
                              Found in deepreg/model/backbone/local_net.py - About 35 mins to fix

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

                                def build_config(
                                Severity: Minor
                                Found in deepreg/train.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 deconv_output_padding has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

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

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

                                      def move_files_into_correct_path(
                                      Severity: Minor
                                      Found in demos/paired_ct_lung/demo_data.py - About 35 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language