iacchus/birdears

View on GitHub

Showing 35 of 64 total issues

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

    def __init__(self, mode='major', tonic='C', octave=4, descending=False,
                 chromatic=False, n_octaves=1, valid_intervals=CHROMATIC_TYPE,
                 user_durations=None, prequestion_method=None,
                 resolution_method=None, default_durations=None,
                 *args, **kwargs):
Severity: Minor
Found in src/birdears/questionbase.py - About 5 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 __init__ has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, cli_prompt_next=False,
                 cli_no_scroll=False, cli_no_resolution=False,
                 exercise=None, *args, **kwargs):
        """This function implements the birdears loop for command line.

Severity: Minor
Found in src/birdears/interfaces/commandline.py - About 4 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 process_key has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    def process_key(self, user_input):

        if user_input in self.question.keyboard_index \
            and user_input != ' ':  # spc

Severity: Minor
Found in src/birdears/interfaces/commandline.py - About 4 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 urwid.py has 328 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import threading

try:
    import urwid
except ImportError:
Severity: Minor
Found in src/birdears/interfaces/urwid.py - About 3 hrs to fix

    File __main__.py has 323 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    "__Main__ docs are here."
    
    try:
        import urwid
    except ImportError:
    Severity: Minor
    Found in src/birdears/__main__.py - About 3 hrs to fix

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

          def __init__(self, scale, question_tonic_pitch, main_loop=None,
                       keyboard_index=None, *args, **kwargs):
      
              self.main_loop = main_loop
      
      
      Severity: Minor
      Found in src/birdears/interfaces/urwid.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 __init__ has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(self, exercise=None, *args, **kwargs):
      
              self.exercise = exercise
              self.arguments = kwargs
      
      
      Severity: Minor
      Found in src/birdears/interfaces/urwid.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 __init__ has 16 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self, mode='major', wait_time=11, n_repeats=1,
      Severity: Major
      Found in src/birdears/questions/instrumentaldictation.py - About 2 hrs to fix

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

            def __init__(self, mode='major', max_intervals=3, n_notes=4, tonic='C',
        Severity: Major
        Found in src/birdears/questions/melodicdictation.py - About 1 hr to fix

          Function async_play has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              def async_play(self, callback, end_callback, args, kwargs):
                  """Plays the Sequence elements of notes and/or chords and wait for
                  `Sequence.pos_delay` seconds.
                  """
          
          
          Severity: Minor
          Found in src/birdears/sequence.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 13 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(self, mode='major', tonic='C', octave=4, descending=False,
          Severity: Major
          Found in src/birdears/questionbase.py - About 1 hr to fix

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

                def __init__(self, mode='major', tonic='C', octave=4, descending=False,
            Severity: Major
            Found in src/birdears/questions/harmonicinterval.py - About 1 hr to fix

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

                  def __init__(self, mode='major', tonic='C', octave=4, descending=False,
              Severity: Major
              Found in src/birdears/questions/notename.py - About 1 hr to fix

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

                    def __init__(self, mode='major', tonic='C', octave=4, descending=False,
                Severity: Major
                Found in src/birdears/questions/melodicinterval.py - About 1 hr to fix

                  Function get_valid_pitches has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def get_valid_pitches(scale, valid_intervals=CHROMATIC_TYPE):
                  
                      tonic_pitch = scale[0]
                  
                      valid_scale = list()
                  Severity: Minor
                  Found in src/birdears/questionbase.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 nearest_tonic has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def nearest_tonic(question):
                      """Resolution method that resolve the intervals to their nearest tonics.
                  
                      Args:
                          question (obj): Question object from which to generate the
                  Severity: Minor
                  Found in src/birdears/resolution.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 highlight_key has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def highlight_key(self, element=None):
                  
                          with LOCK:
                  
                              # for key in self.key_index.values():
                  Severity: Minor
                  Found in src/birdears/interfaces/urwid.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 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def __init__(self, top="", middle="", bottom="", pitch=None, *args,
                  Severity: Minor
                  Found in src/birdears/interfaces/urwid.py - About 45 mins to fix

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

                    def cli(debug, urwid, cli, prompt, no_scroll, no_resolution):
                    Severity: Minor
                    Found in src/birdears/__main__.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if user_input2 in ('q', 'Q'):
                                                  sys.exit()
                                              # any key - play next question
                                              elif user_input2:
                                                  break
                      Severity: Major
                      Found in src/birdears/interfaces/commandline.py - About 45 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language