iacchus/birdears

View on GitHub

Showing 64 of 64 total issues

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

        correct_response_str = "".join([interval['data'][1]
Severity: Minor
Found in src/birdears/questions/melodicdictation.py and 1 other location - About 55 mins to fix
src/birdears/questions/melodicdictation.py on lines 157..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 37.

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

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

        user_response_str = "".join([interval['data'][1].center(string_offset)
Severity: Minor
Found in src/birdears/questions/melodicdictation.py and 1 other location - About 55 mins to fix
src/birdears/questions/melodicdictation.py on lines 160..160

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

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

        Avoid deeply nested control flow statements.
        Open

                                    if self.question.n_input_notes > 1:
                                        self.update_input_display()
        
                                # these inputs are commands to birdears
                                else:
        Severity: Major
        Found in src/birdears/interfaces/urwid.py - About 45 mins to fix

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

              def __init__(self, tonic='C', mode='major', octave=4, n_octaves=1,
          Severity: Minor
          Found in src/birdears/scale.py - About 45 mins to fix

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

                def __init__(self, scale, question_tonic_pitch, main_loop=None,
            Severity: Minor
            Found in src/birdears/interfaces/urwid.py - About 45 mins to fix

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

                  def __init__(self, cli_prompt_next=False,
              Severity: Minor
              Found in src/birdears/interfaces/commandline.py - About 45 mins to fix

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

                    def __init__(self, top_widget=None, keyboard=None, bottom_widget=None,
                Severity: Minor
                Found in src/birdears/interfaces/urwid.py - About 45 mins to fix

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

                  def get_path():
                      """
                      Shortcut for users whose theme is next to their conf.py.
                      """
                      # Theme directory is defined as our parent directory
                  Severity: Minor
                  Found in docs/_themes/birdears_theme_reborn/__init__.py and 1 other location - About 40 mins to fix
                  docs/_themes/birdears_sphinx_theme/__init__.py on lines 7..12

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

                  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

                  def get_path():
                      """
                      Shortcut for users whose theme is next to their conf.py.
                      """
                      # Theme directory is defined as our parent directory
                  Severity: Minor
                  Found in docs/_themes/birdears_sphinx_theme/__init__.py and 1 other location - About 40 mins to fix
                  docs/_themes/birdears_theme_reborn/__init__.py on lines 6..11

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

                  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

                  Consider simplifying this complex logical expression.
                  Open

                          if isinstance(octave, str) and any(el in octave for el in ('R', 'r')):
                              self.octave = randrange(3, 6)
                          elif isinstance(octave, str) and ',' in octave:
                              octave = octave.replace(' ', '')
                              octave = choice(octave.split(','))
                  Severity: Major
                  Found in src/birdears/questionbase.py - About 40 mins to fix

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

                    def update_context(app, pagename, templatename, context, doctree):
                    Severity: Minor
                    Found in docs/_themes/birdears_sphinx_theme/__init__.py - About 35 mins to fix

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

                      def update_context(app, pagename, templatename, context, doctree):
                      Severity: Minor
                      Found in docs/_themes/birdears_theme_reborn/__init__.py - About 35 mins to fix

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

                            def __init__(self, tonic='C', octave=4, n_octaves=1, descending=False,
                        Severity: Minor
                        Found in src/birdears/scale.py - About 35 mins to fix

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

                              def __init__(self, tonic='C', mode='major', octave=4, n_octaves=1,
                                           descending=False, dont_repeat_tonic=False):
                                  """Returns a diatonic scale from tonic and mode.
                          
                                  Args:
                          Severity: Minor
                          Found in src/birdears/scale.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 check_question has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def check_question(self, user_input_char):
                                  """Checks whether the given answer is correct.
                                  """
                          
                                  global INTERVALS
                          Severity: Minor
                          Found in src/birdears/questions/notename.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 draw_question has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def draw_question(self):
                          
                                  if self.exercise != 'notename':
                                      scale = \
                                          ChromaticScale(tonic=self.question.lowest_tonic_pitch.note,
                          Severity: Minor
                          Found in src/birdears/interfaces/urwid.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 log_event has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def log_event(f, *args, **kwargs):
                              """
                              Decorator. Functions and method decorated with this decorator will have
                              their signature logged when birdears is executed with `--debug` mode. Both
                              function signature with their call values and their return will be logged.
                          Severity: Minor
                          Found in src/birdears/logger.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

                          Severity
                          Category
                          Status
                          Source
                          Language