Telefonica/toolium

View on GitHub

Showing 13 of 34 total issues

File dataset.py has 638 lines of code (exceeds 420 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
"""
Copyright 2022 Telefónica Investigación y Desarrollo, S.A.U.
This file is part of Toolium.

Severity: Major
Found in toolium/utils/dataset.py - About 7 hrs to fix

    Function get_steps_from_feature_description has a Cognitive Complexity of 21 (exceeds 10 allowed). Consider refactoring.
    Open

        def get_steps_from_feature_description(self, description):
            """
            get all steps defined in the feature description associated to each action
            :param description: feature description
            """
    Severity: Minor
    Found in toolium/behave/env_utils.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 _find_web_element has a Cognitive Complexity of 20 (exceeds 10 allowed). Consider refactoring.
    Open

        def _find_web_element(self):
            """Find WebElement using element locator and save it in _web_element attribute"""
            if not self._web_element or not self.driver_wrapper.config.getboolean_optional('Driver', 'save_web_element'):
                # check context for mobile webviews
                if self.driver_wrapper.config.getboolean_optional('Driver', 'automatic_context_selection'):
    Severity: Minor
    Found in toolium/pageelements/page_element.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 get_translation_by_poeditor_reference has a Cognitive Complexity of 16 (exceeds 10 allowed). Consider refactoring.
    Open

    def get_translation_by_poeditor_reference(reference, poeditor_terms):
        """
        Return the translation(s) for the given POEditor reference from the given terms in poeditor_terms.
    
        :param reference: POEditor reference
    Severity: Minor
    Found in toolium/utils/dataset.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 save_all_webdriver_or_ggr_logs has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring.
    Open

        def save_all_webdriver_or_ggr_logs(cls, test_name, test_passed, ggr=False):
            """Get all webdriver or GGR logs of each driver and write them to log files
    
            :param test_name: test that has generated these logs
            :param test_passed: True if the test has passed
    Severity: Minor
    Found in toolium/driver_wrappers_pool.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 change_jira_status has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring.
    Open

    def change_jira_status(test_key, test_status, test_comment, test_attachments):
        """Update test status in Jira
    
        :param test_key: test case key in Jira
        :param test_status: test case status
    Severity: Minor
    Found in toolium/jira.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 download_videos has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring.
    Open

        def download_videos(cls, name, test_passed=True, maintain_default=False):
            """Download saved videos if video is enabled or if test fails
    
            :param name: destination file name
            :param test_passed: True if the test has passed
    Severity: Minor
    Found in toolium/driver_wrappers_pool.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_remote_node has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring.
    Open

        def get_remote_node(self):
            """Return the remote node that it's executing the actual test session
    
            :returns: tuple with server type (local, grid, ggr, selenium) and remote node name
            """
    Severity: Minor
    Found in toolium/utils/driver_utils.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 assert_screenshot has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring.
    Open

        def assert_screenshot(self, element, filename, file_suffix=None, threshold=0, exclude_elements=[]):
            """Assert that a screenshot of an element is the same as a screenshot on disk, within a given threshold
    
            :param element: either a WebElement, PageElement or element locator as a tuple (locator_type, locator_value).
                            If None, a full screenshot is taken.
    Severity: Minor
    Found in toolium/visual_test.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 add_jira_status has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
    Open

    def add_jira_status(test_key, test_status, test_comment):
        """Save test status and comments to update Jira later
    
        :param test_key: test case key in Jira
        :param test_status: test case status
    Severity: Minor
    Found in toolium/jira.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 load_poeditor_texts has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
    Open

    def load_poeditor_texts():
        """
        Download POEditor texts and save in output folder if the config exists or use previously downloaded texts
        """
        if get_poeditor_api_token():
    Severity: Minor
    Found in toolium/utils/poeditor.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 exclude_elements has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
    Open

        def exclude_elements(self, img, web_elements):
            """Modify image hiding elements with a black rectangle
    
            :param img: image object
            :param web_elements: WebElement objects to be excluded
    Severity: Minor
    Found in toolium/visual_test.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 is_the_session_still_active has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
    Open

        def is_the_session_still_active(self):
            """
            Is the GGR session still active? Associated to a browser and the sessionId
            Example of GGR status:
            {
    Severity: Minor
    Found in toolium/selenoid.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