adam2392/eegio

View on GitHub

Showing 69 of 69 total issues

Consider simplifying this complex logical expression.
Open

        if (transpose is "horizontal" or "row" and shape[0] > shape[1]) or (
            transpose is "vertical" or "column" and shape[0] < shape[1]
        ):
            shape = list(shape)
            temp = shape[1]
Severity: Major
Found in eegio/base/utils/data_structures_utils.py - About 40 mins to fix

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

        def __init__(
    Severity: Minor
    Found in eegio/base/objects/electrodes/electrode.py - About 35 mins to fix

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

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

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

            def add_participants_field(
        Severity: Minor
        Found in eegio/loaders/bids/bids_patient.py - About 35 mins to fix

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

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

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

                def __init__(
            Severity: Minor
            Found in eegio/base/objects/electrodes/elecs.py - About 35 mins to fix

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

                  def append_channel_info(
              Severity: Minor
              Found in eegio/loaders/bids/bids_run.py - About 35 mins to fix

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

                    def expand_bipolar_chans(ch_list):
                        if isinstance(ch_list, np.ndarray):
                            ch_list = ch_list.tolist()
                        if ch_list == []:
                            return None
                Severity: Minor
                Found in eegio/base/utils/contacts_list_helper.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

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

                        if isinstance(val, dict):
                            formal += "\n" + key + "=["
                            for key2, val2 in val.items():
                                formal += "\n" + str(key2) + " = " + str(val2)
                            formal += "]"
                Severity: Minor
                Found in eegio/base/utils/data_structures_utils.py and 1 other location - About 35 mins to fix
                eegio/base/utils/data_structures_utils.py on lines 452..453

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

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

                def merge_metadata(metadata1, metadata2, overwrite=False):
                    for key in metadata1.keys():
                        if overwrite is False:
                            if key not in metadata2.keys():
                                metadata2[key] = metadata1[key]
                Severity: Minor
                Found in eegio/base/utils/data_structures_utils.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

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

                        for key in keys.keys():
                            if self.data[key] != []:
                                not_empty = True
                Severity: Minor
                Found in eegio/base/dataset_test/dataset_tester.py and 1 other location - About 35 mins to fix
                eegio/base/dataset_test/dataset_tester.py on lines 212..214

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

                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

                        for key in keys.keys():
                            if self.data[key] != []:
                                not_empty = True
                Severity: Minor
                Found in eegio/base/dataset_test/dataset_tester.py and 1 other location - About 35 mins to fix
                eegio/base/dataset_test/dataset_tester.py on lines 185..187

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

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

                    def _initialize_datastructs(self):
                        """
                        Initialize an electrodes dictionary for storing contacts belonging to the same electrode.
                
                        Assumes that all different electrodes have a starting different lettering (e.g. A1, A2, A3 are all from the same
                Severity: Minor
                Found in eegio/base/objects/electrodes/elecs.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

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

                    def __init__(
                        self, bids_root, bids_basename, kind=None, datatype="fif", verbose: bool = True
                    ):
                        self.bids_root = bids_root
                
                
                Severity: Minor
                Found in eegio/loaders/bids/bidsio.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

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

                    def expand_ablated_chans(ch_list):
                        if isinstance(ch_list, np.ndarray):
                            ch_list = ch_list.tolist()
                        if ch_list == []:
                            return None
                Severity: Minor
                Found in eegio/base/utils/contacts_list_helper.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

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

                    def _initialize_datastructs_dev(self):
                        """
                        Initialize an electrodes dictionary for storing contacts belonging to the same electrode.
                
                        Assumes that all different electrodes have a starting different lettering (e.g. A1, A2, A3 are all from the same
                Severity: Minor
                Found in eegio/base/objects/electrodes/elecs.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

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

                            for key2, val2 in val.items():
                                formal += "\n" + str(key2) + " = " + str(val2)
                Severity: Minor
                Found in eegio/base/utils/data_structures_utils.py and 1 other location - About 35 mins to fix
                eegio/base/utils/data_structures_utils.py on lines 450..456

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

                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

                Avoid too many return statements within this function.
                Open

                    return ret
                Severity: Major
                Found in eegio/base/utils/data_structures_utils.py - About 30 mins to fix

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

                          if self.data["onset"] == []:
                              self.problems.append(("onset", []))
                  Severity: Minor
                  Found in eegio/base/dataset_test/dataset_tester.py and 1 other location - About 30 mins to fix
                  eegio/base/dataset_test/dataset_tester.py on lines 156..157

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

                  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

                  Avoid too many return statements within this function.
                  Open

                          return json.JSONEncoder.default(self, obj)
                  Severity: Major
                  Found in eegio/base/utils/data_structures_utils.py - About 30 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language