datalad/datalad-neuroimaging

View on GitHub

Showing 25 of 36 total issues

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

    def __call__(repo_name, repo_accession, repo_url, path=None, output=None, dataset=None):
Severity: Minor
Found in datalad_neuroimaging/bids2scidata.py - About 35 mins to fix

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

    def _struct2dict(struct):
        out = {}
        for k in struct.dir():
            if hasattr(struct, k):
                value = getattr(struct, k)
    Severity: Minor
    Found in datalad_neuroimaging/extractors/dicom.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

    Avoid too many return statements within this function.
    Open

                return '', val
    Severity: Major
    Found in datalad_neuroimaging/bids2scidata.py - About 30 mins to fix

      Function _get_dsmeta has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def _get_dsmeta(self, bids):
              context = {}
              if hasattr(bids, 'get_dataset_description'):
                  # post 0.9.1
                  # https://github.com/bids-standard/pybids/pull/444
      Severity: Minor
      Found in datalad_neuroimaging/extractors/bids.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 _get_bids_entities has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def _get_bids_entities(self, bids):
              """Get dataset-specific entities from BIDSLayout"""
              ds_entities = list(bids.entities.keys())
              new_entities = {}
              # If the entity is in the main list AND in the list
      Severity: Minor
      Found in datalad_neuroimaging/extractors/bids_dataset.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