neurodata/ndmg

View on GitHub

Showing 78 of 78 total issues

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

    def func2atlas(self, func, t1w, atlas, atlas_brain, atlas_mask,
Severity: Major
Found in ndmg/register/register.py - About 1 hr to fix

    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

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

                edge_list = [(k[0], k[1], v) for k, v in self.edge_dict.items()]
        Severity: Major
        Found in ndmg/graph/graph.py and 1 other location - About 1 hr to fix
        ndmg/graph/graph.py on lines 129..129

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 38.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

        def group_level(inDir, outDir, dataset=None, atlas=None, minimal=False,
                        log=False, hemispheres=False, dwi=True):
            """
            Crawls the output directory from ndmg and computes qc metrics on the
            derivatives produced
        Severity: Minor
        Found in ndmg/scripts/ndmg_bids.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 crawl_bucket has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        def crawl_bucket(bucket, path, group=False):
            """
            Gets subject list for a given S3 bucket and path
            """
            if group:
        Severity: Minor
        Found in ndmg/scripts/ndmg_cloud.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

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

            fname = os.path.split(fname)[1].split(".")[0] + '.png'
        Severity: Major
        Found in ndmg/stats/qa_tensor.py and 4 other locations - About 55 mins to fix
        ndmg/stats/qa_adjacency.py on lines 47..48
        ndmg/stats/qa_fibers.py on lines 87..87
        ndmg/stats/qa_reg.py on lines 60..60
        ndmg/stats/qa_tensor.py on lines 55..55

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 37.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

            fname = os.path.split(fibfile)[1].split('.')[0] + '.png'
        Severity: Major
        Found in ndmg/stats/qa_fibers.py and 4 other locations - About 55 mins to fix
        ndmg/stats/qa_adjacency.py on lines 47..48
        ndmg/stats/qa_reg.py on lines 60..60
        ndmg/stats/qa_tensor.py on lines 55..55
        ndmg/stats/qa_tensor.py on lines 68..68

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 37.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

            if fname is None:
                fname = os.path.split(infile)[1].split('.')[0] + '.png'
        Severity: Major
        Found in ndmg/stats/qa_adjacency.py and 4 other locations - About 55 mins to fix
        ndmg/stats/qa_fibers.py on lines 87..87
        ndmg/stats/qa_reg.py on lines 60..60
        ndmg/stats/qa_tensor.py on lines 55..55
        ndmg/stats/qa_tensor.py on lines 68..68

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 37.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function ndmg_dwi_pipeline has a Cognitive Complexity of 9 (exceeds 5 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 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 loadGraphs has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        def loadGraphs(filenames, verb=False):
            """
            Given a list of files, returns a dictionary of graphs
        
            Required parameters:
        Severity: Minor
        Found in ndmg/utils/loadGraphs.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

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

            fname = os.path.split(tensor_name)[1].split(".")[0] + '_fa_rgb.nii.gz'
        Severity: Major
        Found in ndmg/stats/qa_tensor.py and 4 other locations - About 55 mins to fix
        ndmg/stats/qa_adjacency.py on lines 47..48
        ndmg/stats/qa_fibers.py on lines 87..87
        ndmg/stats/qa_reg.py on lines 60..60
        ndmg/stats/qa_tensor.py on lines 68..68

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 37.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

            fname = os.path.split(mri)[1].split(".")[0] + '.png'
        Severity: Major
        Found in ndmg/stats/qa_reg.py and 4 other locations - About 55 mins to fix
        ndmg/stats/qa_adjacency.py on lines 47..48
        ndmg/stats/qa_fibers.py on lines 87..87
        ndmg/stats/qa_tensor.py on lines 55..55
        ndmg/stats/qa_tensor.py on lines 68..68

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 37.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function dwi2atlas has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def dwi2atlas(self, dwi, gtab, t1w, atlas,
        Severity: Major
        Found in ndmg/register/register.py - About 50 mins to fix

          Function make_panel_plot has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def make_panel_plot(basepath, outf, dataset=None, atlas=None, minimal=True,
          Severity: Major
          Found in ndmg/stats/qa_graphs_plotting.py - About 50 mins to fix

            Function session_level has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def session_level(inDir, outDir, subjs, sesh=None, debug=False,
            Severity: Major
            Found in ndmg/scripts/ndmg_bids.py - About 50 mins to fix

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                      elif status in ['STARTING', 'RUNNING']:
                          cmd = cmd_template2.format(jid, reason)
                          print("... Terminating job {}...".format(name))
                          out, err = mgu.execute_cmd(cmd)
              Severity: Minor
              Found in ndmg/scripts/ndmg_cloud.py and 1 other location - About 50 mins to fix
              ndmg/scripts/ndmg_cloud.py on lines 249..252

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 36.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                      elif status in ['SUBMITTED', 'PENDING', 'RUNNABLE']:
                          cmd = cmd_template1.format(jid, reason)
                          print("... Cancelling job {}...".format(name))
                          out, err = mgu.execute_cmd(cmd)
              Severity: Minor
              Found in ndmg/scripts/ndmg_cloud.py and 1 other location - About 50 mins to fix
              ndmg/scripts/ndmg_cloud.py on lines 253..256

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 36.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                      g1 = mgg(len(np.unique(labels_im.get_data()))-1, labels[idx])
              Severity: Minor
              Found in ndmg/scripts/multigraph_pipeline.py and 1 other location - About 50 mins to fix
              ndmg/scripts/ndmg_dwi_pipeline.py on lines 114..114

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 36.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  adj = OrderedDict((subj, nx.adj_matrix(graphs[subj]).todense())
              Severity: Minor
              Found in ndmg/stats/qa_graphs.py and 1 other location - About 50 mins to fix
              ndmg/stats/qa_graphs.py on lines 103..103

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 36.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Severity
              Category
              Status
              Source
              Language