adam2392/eegio

View on GitHub

Showing 69 of 69 total issues

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 convert_to_bids has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def convert_to_bids(
    Severity: Major
    Found in eegio/base/utils/bids_helper.py - About 1 hr to fix

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

          timepoints = np.append(timestarts[:, np.newaxis], timeends[:, np.newaxis], axis=1)
      Severity: Major
      Found in eegio/base/utils/data_structures_utils.py and 1 other location - About 1 hr to fix
      eegio/base/utils/data_structures_utils.py on lines 177..178

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

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

            samplepoints = np.append(
                samplestarts[:, np.newaxis], sampleends[:, np.newaxis], axis=1
        Severity: Major
        Found in eegio/base/utils/data_structures_utils.py and 1 other location - About 1 hr to fix
        eegio/base/utils/data_structures_utils.py on lines 245..245

        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 saveas_edf has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def saveas_edf(
        Severity: Major
        Found in eegio/writers/saveas.py - About 50 mins to fix

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

              def __init__(
          Severity: Major
          Found in eegio/base/objects/derivatives/result_object.py - About 50 mins to fix

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

                def find_seizure_onset(
            Severity: Major
            Found in eegio/base/utils/scrubber.py - About 50 mins to fix

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

                  def find_seizure_offset(
              Severity: Major
              Found in eegio/base/utils/scrubber.py - About 50 mins to fix

                Function saveas_fif has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def saveas_fif(self, fpath, rawdata, info, bad_chans_list=[], montage: List = []):
                Severity: Minor
                Found in eegio/writers/saveas.py - About 45 mins to fix

                  Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def __init__(
                  Severity: Minor
                  Found in eegio/loaders/bids/bidsio.py - About 45 mins to fix

                    Function saveas_hdf has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def saveas_hdf(
                    Severity: Minor
                    Found in eegio/writers/saveas.py - About 45 mins to fix

                      Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def __init__(
                      Severity: Minor
                      Found in eegio/loaders/bids/bidsio.py - About 45 mins to fix

                        Function copy_object_attributes has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        def copy_object_attributes(
                        Severity: Minor
                        Found in eegio/base/utils/data_structures_utils.py - About 45 mins to fix

                          Function findtimewins has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def findtimewins(times, timepoints):
                              indices = []
                              for time in ensure_list(times):
                                  if time == 0:
                                      indices.append(time)
                          Severity: Minor
                          Found in eegio/base/utils/data_structures_utils.py - About 45 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 _check_keys has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def _check_keys(self, keys):
                                  for key, possibilities in keys.items():
                                      if key in self.data.keys():
                                          if self.data[key] in possibilities:
                                              continue
                          Severity: Minor
                          Found in eegio/base/dataset_test/dataset_tester.py - About 45 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 formal_repr has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def formal_repr(instance, attr_dict, sort_dict_flag=False):
                              """ A formal string representation for an object.
                              :param attr_dict: dictionary attribute_name: attribute_value
                              :param instance:  Instance to read class name from it
                              """
                          Severity: Minor
                          Found in eegio/base/utils/data_structures_utils.py - About 45 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

                          Consider simplifying this complex logical expression.
                          Open

                                      if (
                                          isinstance(field1, str)
                                          or isinstance(field1, list)
                                          or isinstance(field1, dict)
                                          or (isinstance(field1, np.ndarray) and field1.dtype.kind in "OSU")
                          Severity: Major
                          Found in eegio/base/utils/data_structures_utils.py - About 40 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language