MTG/SymbTr-extras

View on GitHub

Showing 10 of 10 total issues

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

    def parse_usul_dict(cls):
        mu2_usul_dict = {}
        inv_mu2_usul_dict = {}
        usul_dict = cls.get_usul_dict()
        for key, val in iteritems(usul_dict):
Severity: Minor
Found in symbtrextras/scoreextras.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 correct_offset_gracenote has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def correct_offset_gracenote(cls, txt_file, mu2_file):
        # extract symbtr data
        data = ScoreExtras.get_symbtr_data(txt_file, mu2_file)

        # get zaman and mertebe from usul variant
Severity: Minor
Found in symbtrextras/txtextras.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 _chk_usul_by_id has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def _chk_usul_by_id(cls, index, inv_mu2_usul_dict, row, symbtr_name,
Severity: Major
Found in symbtrextras/txtextras.py - About 50 mins to fix

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

                    (row['Kod'], row['Koma53'], row['KomaAE'], row['Nota53'],
                     row['NotaAE']) = rest_list
    Severity: Minor
    Found in symbtrextras/txtextras.py and 1 other location - About 50 mins to fix
    symbtrextras/txtextras.py on lines 208..209

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

    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

                val_list = [row['Kod'], row['Koma53'], row['KomaAE'],
                            row['Nota53'], row['NotaAE']]
    Severity: Minor
    Found in symbtrextras/txtextras.py and 1 other location - About 50 mins to fix
    symbtrextras/txtextras.py on lines 216..217

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

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

        def _parse_usul_row(cls, row, index, mu2_usul_dict, inv_mu2_usul_dict,
    Severity: Minor
    Found in symbtrextras/txtextras.py - About 45 mins to fix

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

          def _chk_usul_by_name(cls, index, mu2_usul_dict, row, symbtr_name, usul_id,
      Severity: Minor
      Found in symbtrextras/txtextras.py - About 45 mins to fix

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

            def _chk_usul_attr(row, usul, attr_str, symbtr_name, index, usul_name):
        Severity: Minor
        Found in symbtrextras/txtextras.py - About 35 mins to fix

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

              def add_usul_to_first_row(cls, txt_file, mu2_file):
                  # extract symbtr data
                  data = ScoreExtras.get_symbtr_data(txt_file, mu2_file)
          
                  # get usul variant
          Severity: Minor
          Found in symbtrextras/txtextras.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 _get_zaman_mertebe has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def _get_zaman_mertebe(data):
                  usul_dict = ScoreExtras.get_usul_dict()
                  for usul in usul_dict.values():
                      for uv in usul['variants']:
                          if uv['mu2_name'] == data['usul']['mu2_name']:
          Severity: Minor
          Found in symbtrextras/txtextras.py - About 25 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