ArturSpirin/test_junkie

View on GitHub

Showing 113 of 184 total issues

Merge this if statement with the enclosing one.
Open

                    if not self.requested_suites or \
Severity: Major
Found in test_junkie/cli/cli_runner.py by sonar-python

Merging collapsible if statements increases the code's readability.

Noncompliant Code Example

if condition1:
    if condition2:
        # ...

Compliant Solution

if condition1 and condition2:
    # ...

Merge this if statement with the enclosing one.
Open

                        if record_test_failure:  # Test failed and failure was already recorded thus can't pass it
Severity: Major
Found in test_junkie/runner.py by sonar-python

Merging collapsible if statements increases the code's readability.

Noncompliant Code Example

if condition1:
    if condition2:
        # ...

Compliant Solution

if condition1 and condition2:
    # ...

Merge this if statement with the enclosing one.
Open

                        if suite.get_decorated_definition(DecoratorType.AFTER_TEST):
Severity: Major
Found in test_junkie/runner.py by sonar-python

Merging collapsible if statements increases the code's readability.

Noncompliant Code Example

if condition1:
    if condition2:
        # ...

Compliant Solution

if condition1 and condition2:
    # ...

Refactor this function to reduce its Cognitive Complexity from 38 to the 15 allowed.
Open

    def run(self, **kwargs):
Severity: Critical
Found in test_junkie/runner.py by sonar-python

Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

See

Refactor this function to reduce its Cognitive Complexity from 142 to the 15 allowed.
Open

    def __run_suite(self, suite):
Severity: Critical
Found in test_junkie/runner.py by sonar-python

Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

See

Refactor this function to reduce its Cognitive Complexity from 49 to the 15 allowed.
Open

    def test_qualifies(self, test):
Severity: Critical
Found in test_junkie/parallels.py by sonar-python

Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

See

Rename function "js" to match the regular expression ^[a-z_][a-z0-9_]{2,}$.
Open

        def js():

Shared coding conventions allow teams to collaborate efficiently. This rule checks that all function names match a provided regular expression.

Noncompliant Code Example

With the default provided regular expression: ^[a-z_][a-z0-9_]{2,30}$

def MyFunction(a,b):
    ...

Compliant Solution

def my_function(a,b):
    ...

Rename function "js" to match the regular expression ^[a-z_][a-z0-9_]{2,}$.
Open

        def js():

Shared coding conventions allow teams to collaborate efficiently. This rule checks that all function names match a provided regular expression.

Noncompliant Code Example

With the default provided regular expression: ^[a-z_][a-z0-9_]{2,30}$

def MyFunction(a,b):
    ...

Compliant Solution

def my_function(a,b):
    ...

Rename function "js" to match the regular expression ^[a-z_][a-z0-9_]{2,}$.
Open

        def js():

Shared coding conventions allow teams to collaborate efficiently. This rule checks that all function names match a provided regular expression.

Noncompliant Code Example

With the default provided regular expression: ^[a-z_][a-z0-9_]{2,30}$

def MyFunction(a,b):
    ...

Compliant Solution

def my_function(a,b):
    ...

Refactor this function to reduce its Cognitive Complexity from 105 to the 15 allowed.
Open

    def aggregate(self):
Severity: Critical
Found in test_junkie/cli/cli_audit.py by sonar-python

Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

See

Refactor this function to reduce its Cognitive Complexity from 31 to the 15 allowed.
Open

    def scan(self):
Severity: Critical
Found in test_junkie/cli/cli_runner.py by sonar-python

Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

See

Refactor this function to reduce its Cognitive Complexity from 77 to the 15 allowed.
Open

    def __run_test(suite, test, parameter=None, class_parameter=None, before_class_error=None, cancel=False):
Severity: Critical
Found in test_junkie/runner.py by sonar-python

Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

See

Remove this commented out code.
Open

                # self.aggregated_data["absolute_test_count"] += 1
Severity: Major
Found in test_junkie/cli/cli_audit.py by sonar-python

Programmers should not comment out code as it bloats programs and reduces readability.

Unused code should be deleted and can be retrieved from source control history if required.

See

  • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
  • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
  • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
  • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"
Severity
Category
Status
Source
Language