neurodata/ndmg

View on GitHub

Showing 44 of 78 total issues

Function create_json has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
Open

def create_json(bucket, path, threads, jobdir, group=False, credentials=None,
                debug=False, dataset=None, log=False):
    """
    Takes parameters to make jsons
    """
Severity: Minor
Found in ndmg/scripts/ndmg_cloud.py - About 7 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 make_panel_plot has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
Open

def make_panel_plot(basepath, outf, dataset=None, atlas=None, minimal=True,
                    log=True, hemispheres=True):
    fnames = [name for name in os.listdir(basepath)
              if os.path.splitext(name)[1] == '.pkl']
    fnames = sorted(fnames)
Severity: Minor
Found in ndmg/stats/qa_graphs_plotting.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 main has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

def main():
    parser = ArgumentParser(description="This is an end-to-end connectome \
                            estimation pipeline from sMRI and DTI images")

    parser.add_argument('bids_dir', help='The directory with the input dataset'
Severity: Minor
Found in ndmg/scripts/ndmg_bids.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 convert has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

def convert(indir, outdir,  verbose=False):
    """
    Takes in nifti images, creates directory structure desired by ndstore
    ingest, and then converts niftis to png stacks. This script should be
    called prior to ingesting MR data into ndstore.
Severity: Minor
Found in ndmg/utils/nifti_to_png.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

File register.py has 278 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python

# Copyright 2016 NeuroData (http://neurodata.io)
#
# Licensed under the Apache License, Version 2.0 (the "License");
Severity: Minor
Found in ndmg/register/register.py - About 2 hrs to fix

    File ndmg_cloud.py has 263 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    #!/usr/bin/env python
    
    # Copyright 2016 NeuroData (http://neurodata.io)
    #
    # Licensed under the Apache License, Version 2.0 (the "License");
    Severity: Minor
    Found in ndmg/scripts/ndmg_cloud.py - About 2 hrs to fix

      Function compute_metrics has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def compute_metrics(fs, outdir, atlas, verb=False):
          """
          Given a set of files and a directory to put things, loads graphs and
          performs set of analyses on them, storing derivatives in a pickle format
          in the desired output location.
      Severity: Minor
      Found in ndmg/stats/qa_graphs.py - About 1 hr to fix

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

            def make_graph(self, streamlines, attr=None):
                """
                Takes streamlines and produces a graph
        
                **Positional Arguments:**
        Severity: Minor
        Found in ndmg/graph/graph.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 plot_overlays has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        def plot_overlays(atlas, b0, cmaps):
            plt.rcParams.update({'axes.labelsize': 'x-large',
                                 'axes.titlesize': 'x-large'})
        
            if b0.shape == (182, 218, 182):
        Severity: Minor
        Found in ndmg/stats/qa_reg.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 plot_rgb has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        def plot_rgb(im):
            plt.rcParams.update({'axes.labelsize': 'x-large',
                                 'axes.titlesize': 'x-large'})
        
            if im.shape == (182, 218, 182):
        Severity: Minor
        Found in ndmg/stats/qa_tensor.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 crawl_bids_directory has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

        def crawl_bids_directory(inDir, subjs, sesh):
            """
            Given a BIDS directory and optionally list of sessions and subjects,
            crawls the path and returns pointers to all relevant files for analysis.
            """
        Severity: Minor
        Found in ndmg/utils/bids.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 main has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        def main():
            parser = ArgumentParser(description="This is an end-to-end connectome \
                                    estimation pipeline from sMRI and DTI images")
        
            parser.add_argument('bids_dir', help='The directory with the input dataset'
        Severity: Minor
        Found in ndmg/scripts/ndmg_bids.py - About 1 hr to fix

          Function ndmg_dwi_pipeline has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          def ndmg_dwi_pipeline(dwi, bvals, bvecs, mprage, atlas, mask, labels, outdir,
                            clean=False, fmt='edgelist'):
              """
              Creates a brain graph from MRI data
              """
          Severity: Minor
          Found in ndmg/scripts/ndmg_dwi_pipeline.py - About 1 hr to fix

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

            def ndmg_dwi_pipeline(dwi, bvals, bvecs, mprage, atlas, mask, labels, outdir,
            Severity: Major
            Found in ndmg/scripts/ndmg_dwi_pipeline.py - About 1 hr to fix

              Function main has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              def main():
              
                  ni = NI.NDIngest()
              
                  """
              Severity: Minor
              Found in ndmg/utils/mri_autoingest.py - About 1 hr to fix

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

                def create_json(bucket, path, threads, jobdir, group=False, credentials=None,
                Severity: Major
                Found in ndmg/scripts/ndmg_cloud.py - About 1 hr to fix

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

                      def align(self, inp, ref, xfm=None, out=None, dof=12, searchrad=True,
                  Severity: Major
                  Found in ndmg/register/register.py - About 1 hr to fix

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

                    def main():
                        parser = ArgumentParser(description="This is an end-to-end connectome \
                                                estimation pipeline from sMRI and DTI images")
                    
                        parser.add_argument('state', choices=['session',
                    Severity: Minor
                    Found in ndmg/scripts/ndmg_cloud.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 batch_submit has 8 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def batch_submit(bucket, path, jobdir, credentials=None, state='session',
                    Severity: Major
                    Found in ndmg/scripts/ndmg_cloud.py - About 1 hr to fix

                      Function group_level has 8 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      def group_level(inDir, outDir, dataset=None, atlas=None, minimal=False,
                      Severity: Major
                      Found in ndmg/scripts/ndmg_bids.py - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language