adam2392/eegio

View on GitHub

Showing 57 of 69 total issues

File data_structures_utils.py has 660 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Data structure manipulations and conversions
import contextlib
import io
import json
import ntpath
Severity: Major
Found in eegio/base/utils/data_structures_utils.py - About 1 day to fix

    Function assert_arrays has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
    Open

    def assert_arrays(params, shape=None, transpose=False):
        # type: (object, object) -> object
        if shape is None or not (
            isinstance(shape, tuple)
            and len(shape) in range(3)
    Severity: Minor
    Found in eegio/base/utils/data_structures_utils.py - About 1 day 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 assert_equal_objects has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
    Open

    def assert_equal_objects(obj1, obj2, attributes_dict=None, logger=None):
        def print_not_equal_message(attr, field1, field2, logger):
            # logger.error("\n\nValueError: Original and read object field "+ attr + " not equal!")
            # raise_value_error("\n\nOriginal and read object field " + attr + " not equal!")
            logger.warning(
    Severity: Minor
    Found in eegio/base/utils/data_structures_utils.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

    File bidsio.py has 420 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """
    Authors: Adam Li and Patrick Myers.
    
    Version: 1.0
    """
    Severity: Minor
    Found in eegio/loaders/bids/bidsio.py - About 6 hrs to fix

      File bids_patient.py has 414 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      """
      Authors: Adam Li and Patrick Myers.
      
      Version: 1.0
      """
      Severity: Minor
      Found in eegio/loaders/bids/bids_patient.py - About 5 hrs to fix

        File elecs.py has 412 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import collections
        import re
        import warnings
        from typing import List, Dict, Union, Tuple
        
        
        Severity: Minor
        Found in eegio/base/objects/electrodes/elecs.py - About 5 hrs to fix

          File bids_helper.py has 352 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          """
          Authors: Adam Li and Patrick Myers.
          
          Version: 1.0
          """
          Severity: Minor
          Found in eegio/base/utils/bids_helper.py - About 4 hrs to fix

            File bids_run.py has 325 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            """
            Authors: Adam Li and Patrick Myers.
            
            Version: 1.0
            """
            Severity: Minor
            Found in eegio/loaders/bids/bids_run.py - About 3 hrs to fix

              File basedataobject.py has 283 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import copy
              import warnings
              from abc import ABC, abstractmethod
              from typing import List, Dict, Union, Tuple
              
              
              Severity: Minor
              Found in eegio/base/objects/derivatives/basedataobject.py - About 2 hrs to fix

                File saveas.py has 270 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import datetime
                import os
                import warnings
                from typing import List, Dict, Union
                
                
                Severity: Minor
                Found in eegio/writers/saveas.py - About 2 hrs to fix

                  Function find_seizure_offset has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def find_seizure_offset(
                          cls,
                          event_onsets: List[int],
                          event_durations: List[float],
                          event_keys: List[int],
                  Severity: Minor
                  Found in eegio/base/utils/scrubber.py - About 2 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 find_seizure_onset has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def find_seizure_onset(
                          cls,
                          event_onsets: List[int],
                          event_durations: List[float],
                          event_keys: List[int],
                  Severity: Minor
                  Found in eegio/base/utils/scrubber.py - About 2 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 copy_object_attributes has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def copy_object_attributes(
                      obj1, obj2, attr1, attr2=None, deep_copy=False, check_none=False
                  ):
                      attr1 = ensure_list(attr1)
                      if attr2 is None:
                  Severity: Minor
                  Found in eegio/base/utils/data_structures_utils.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 convert_to_bids has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def convert_to_bids(
                          edf_fpath,
                          bids_root,
                          bids_basename,
                          coords_fpath=None,
                  Severity: Minor
                  Found in eegio/base/utils/bids_helper.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 _check_cez_labels_in_chans has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _check_cez_labels_in_chans(self):
                          """
                          Check the cez labels for contact level.
                  
                          :return: None
                  Severity: Minor
                  Found in eegio/base/dataset_test/dataset_tester.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 label_channel_types has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def label_channel_types(cls, labels: List[str]):
                          """
                          Load in the channel types and try to infer them.
                          The possibilities are: EEG, STIM, EOG, EKG, Misc. that are from MNE-Python.
                  
                  
                  Severity: Minor
                  Found in eegio/base/utils/scrubber.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 __init__ has 9 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def __init__(
                  Severity: Major
                  Found in eegio/base/objects/derivatives/basedataobject.py - About 1 hr to fix

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

                        def get_seeg_ngbhrs(chanlabels, contact: str):
                            """
                            Helper function to get neighboring contacts for SEEG contacts using regex.
                    
                            Parameters
                    Severity: Minor
                    Found in eegio/base/utils/contacts_list_helper.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 obj_to_dict has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def obj_to_dict(obj):
                        """
                        :param obj: Python object to introspect
                        :return: dictionary after recursively taking obj fields and their values
                        """
                    Severity: Minor
                    Found in eegio/base/utils/data_structures_utils.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 _pyedf_saveas_edf has 8 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def _pyedf_saveas_edf(
                    Severity: Major
                    Found in eegio/writers/saveas.py - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language