neurodata/ndmg

View on GitHub
ndmg/scripts/ndmg_bids.py

Summary

Maintainability
C
1 day
Test Coverage

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 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 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

      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 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

        Avoid deeply nested control flow statements.
        Open

                            if sesh is not None:
                                tpath = op.join(remo, 'sub-{}'.format(sub), 'ses-{}'.format(sesh))
                                tindir = op.join(inDir, 'sub-{}'.format(sub), 'ses-{}'.format(sesh))
                            else:
                                tpath = op.join(remo, 'sub-{}'.format(sub))
        Severity: Major
        Found in ndmg/scripts/ndmg_bids.py - About 45 mins to fix

          There are no issues that match your filters.

          Category
          Status