kodi-czsk/plugin.video.sosac.ph

View on GitHub

Showing 88 of 88 total issues

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

    def add_item_to_library(self, item_path, item_url):
        error = False
        new = False
        if item_path:
            item_path = xbmc.translatePath(item_path)
Severity: Minor
Found in resources/lib/sutils.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

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

                item['menu'] = {
                    LIBRARY_MENU_ITEM_ADD: {
                        'url': item['url'],
                        'type': LIBRARY_TYPE_VIDEO,
                        'action': LIBRARY_ACTION_ADD,
Severity: Minor
Found in resources/lib/sosac.py and 1 other location - About 55 mins to fix
resources/lib/sosac.py on lines 330..335

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

                item['menu'] = {
                    LIBRARY_MENU_ITEM_ADD: {
                        'url': item['url'],
                        'type': LIBRARY_TYPE_TVSHOW,
                        'action': LIBRARY_ACTION_ADD,
Severity: Minor
Found in resources/lib/sosac.py and 1 other location - About 55 mins to fix
resources/lib/sosac.py on lines 283..288

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

Avoid deeply nested control flow statements.
Open

                        if self.dialog.iscanceled():
                            return
                        if 'progress' in show:
Severity: Major
Found in resources/lib/sutils.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if self.dialog.iscanceled():
                                return
                            if 'progress' in video:
    Severity: Major
    Found in resources/lib/sutils.py - About 45 mins to fix

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

          def __init__(self, username=None, password=None, filter=None, reverse_eps=False,
      Severity: Minor
      Found in resources/lib/sosac.py - About 45 mins to fix

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

                year = (" (" + video['y'] + ")") if video['y'] else " "
        Severity: Minor
        Found in resources/lib/sosac.py and 1 other location - About 45 mins to fix
        resources/lib/sosac.py on lines 426..426

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

        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 deeply nested control flow statements.
        Open

                                if next_check < time.time():
                                    if not notified:
                                        self.showNotification(
                                            'Subscription', 'Chcecking')
                                        notified = True
        Severity: Major
        Found in resources/lib/sutils.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if 'progress' in show:
                                      self.dialog.update(show['progress'])
                                  else:
                                      item = show['menu'][sosac.LIBRARY_MENU_ITEM_ADD]
                                      item["update"] = True
          Severity: Major
          Found in resources/lib/sutils.py - About 45 mins to fix

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

                    year = (" (" + video['y'] + ")") if video['y'] else " "
            Severity: Minor
            Found in resources/lib/sosac.py and 1 other location - About 45 mins to fix
            resources/lib/sosac.py on lines 420..420

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

            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 deeply nested control flow statements.
            Open

                                    if 'progress' in video:
                                        self.dialog.update(video['progress'])
                                    else:
                                        item = video['menu'][sosac.LIBRARY_MENU_ITEM_ADD]
                                        item["update"] = True
            Severity: Major
            Found in resources/lib/sutils.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if 'progress' in video:
                                          self.dialog.update(video['progress'])
                                      else:
                                          item = video['menu'][sosac.LIBRARY_MENU_ITEM_ADD]
                                          item["update"] = True
              Severity: Major
              Found in resources/lib/sutils.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if self.dialog.iscanceled():
                                            return
                                        if 'progress' in video:
                Severity: Major
                Found in resources/lib/sutils.py - About 45 mins to fix

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

                              def http_error_302(self, req, fp, code, msg, headers):
                  Severity: Minor
                  Found in resources/lib/sosac.py - About 35 mins to fix

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

                                if RATING in serial:
                                    item['rating'] = serial[RATING] * RATING_STEP
                    Severity: Minor
                    Found in resources/lib/sosac.py and 1 other location - About 35 mins to fix
                    resources/lib/sosac.py on lines 275..276

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

                        def service(self):
                            util.info("SOSAC Service Started")
                            try:
                                sleep_time = int(self.getSetting("start_sleep_time")) * 1000 * 60 * 60
                            except:
                    Severity: Minor
                    Found in resources/lib/sutils.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 RATING in video:
                                        item['rating'] = video[RATING] * RATING_STEP
                    Severity: Minor
                    Found in resources/lib/sosac.py and 1 other location - About 35 mins to fix
                    resources/lib/sosac.py on lines 318..319

                    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
                    Severity: Major
                    Found in resources/lib/sutils.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                                  return
                      Severity: Major
                      Found in resources/lib/sutils.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                                    return
                        Severity: Major
                        Found in resources/lib/sutils.py - About 30 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language