goodplay/goodplay

View on GitHub

Showing 14 of 15 total issues

File test_ansible_role_support_integration.py has 552 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-

import pytest

from goodplay_helpers import smart_create
Severity: Major
Found in tests/test_ansible_role_support_integration.py - About 1 day to fix

    File test_ansible_runner_integration.py has 477 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    
    import logging
    
    import pytest
    Severity: Minor
    Found in tests/test_ansible_runner_integration.py - About 7 hrs to fix

      File test_collection.py has 467 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      
      from goodplay_helpers import smart_create
      
      
      
      Severity: Minor
      Found in tests/test_collection.py - About 7 hrs to fix

        File test_docker_support_integration.py has 291 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        
        import pytest
        
        from goodplay_helpers import skip_if_no_docker, smart_create
        Severity: Minor
        Found in tests/test_docker_support_integration.py - About 3 hrs to fix

          CallbackModule has 22 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class CallbackModule(CallbackBase):
              CALLBACK_VERSION = 2.0
              CALLBACK_TYPE = 'notification'
              CALLBACK_NAME = 'goodplay'
          
          
          Severity: Minor
          Found in goodplay/ansible_support/callback_plugin/goodplay.py - About 2 hrs to fix

            Function config_paths_for_playbook_path has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            def config_paths_for_playbook_path(playbook_path):  # noqa: R701
                base_path = playbook_path.dirpath()
            
                # get relative config names sorted descending by len
                config_names = [path.relto(base_path) for path in base_path.listdir(is_docker_compose_file)]
            Severity: Minor
            Found in goodplay/docker_support/__init__.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 monkeypatch_play_context has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            def monkeypatch_play_context():
                original_set_task_and_variable_override = PlayContext.set_task_and_variable_override
            
                def goodplay_set_task_and_variable_override(self, task, *args, **kwargs):
                    new_info = original_set_task_and_variable_override(self, task, *args, **kwargs)
            Severity: Minor
            Found in goodplay/ansible_support/callback_plugin/goodplay.py - About 45 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 smart_content_iter has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            def smart_content_iter(smart_content, path_prefix):
                rel_path = None
                content = []
            
                for line in smart_content.splitlines():
            Severity: Minor
            Found in tests/helpers/goodplay_helpers.py - About 45 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 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(self, ctx, fspath, parent=None, config=None, session=None):
            Severity: Minor
            Found in goodplay/plugin.py - About 35 mins to fix

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

              def smart_create(base_path, smart_content):
                  smart_content = textwrap.dedent(smart_content)
              
                  print(smart_content)
              
              
              Severity: Minor
              Found in tests/helpers/goodplay_helpers.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 role_path has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def role_path(self):
                      for ancestor_path in self.playbook_path.parts(reverse=True)[1:]:
                          if ancestor_path.basename == 'tests':
                              role_path = ancestor_path.dirpath()
                              is_role_path = role_path.join('meta', 'main.yml').check(file=True)
              Severity: Minor
              Found in goodplay/context.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

              Function __iter__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def __iter__(self):
                      # override default Capture to read lines as long as streams are open,
                      # thus iteration is not being stopped by large pauses between lines
                      # being available
                      while self.streams_open():
              Severity: Minor
              Found in goodplay/utils/subprocess.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

              Function final_test_task_outcome has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def final_test_task_outcome(self):
                      if self.per_host_outcomes:
                          outcomes = set(x['outcome'] for x in self.per_host_outcomes.values())
                          outcome_priority = ('failed', 'skipped', 'passed')
                          for outcome in outcome_priority:
              Severity: Minor
              Found in goodplay/ansible_support/callback_plugin/goodplay.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

              Function wait_for_event has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def wait_for_event(self, event_name=None, **kwargs):
                      for event in self.receive_events():
                          if event['event_name'] == event_name \
                                  and set(kwargs.items()).issubset(set(event['data'].items())):
                              return event
              Severity: Minor
              Found in goodplay/ansible_support/runner.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