ComplianceAsCode/content

View on GitHub

Showing 957 of 957 total issues

Merge this if statement with the enclosing one.
Open

                if re.search(ref_exp, ref.text):
Severity: Major
Found in ssg/build_derivatives.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 extra_product_id != product_yaml["product"]:
Severity: Major
Found in ssg/products.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 18 to the 15 allowed.
Open

    def _collect_items_to_load(self, guide_directory):
Severity: Critical
Found in ssg/build_yaml.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

Merge this if statement with the enclosing one.
Open

            if self.is_benchmark():
Severity: Major
Found in ssg/xml.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:
    # ...

Function "reference_check" has 8 parameters, which is greater than the 7 authorized.
Open

def reference_check(env_yaml, rule_dirs, profile_path, product, product_yaml, reference,
                    excludes, controls_manager=None):
Severity: Major
Found in utils/refchecker.py by sonar-python

A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.

Noncompliant Code Example

With a maximum number of 4 parameters:

def do_something(param1, param2, param3, param4, param5):
    ...

Compliant Solution

def do_something(param1, param2, param3, param4):
    ...

Merge this if statement with the enclosing one.
Open

        if not os.path.isdir(group_path):
Severity: Major
Found in utils/add_kubernetes_rule.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:
    # ...

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

def clusterTestFunc(args):
Severity: Major
Found in utils/add_kubernetes_rule.py by sonar-python

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 23 to the 15 allowed.
Open

def determine_ip(domain):
Severity: Critical
Found in tests/ssg_test_suite/virt.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

Either remove or fill this block of code.
Open

                        pass
Severity: Major
Found in ssg/ext/boolean/boolean.py by sonar-python

Most of the time a block of code is empty when a piece of code is really missing. So such empty block must be either filled or removed.

Noncompliant Code Example

for i in range(3):
    pass

Exceptions

When a block contains a comment, this block is not considered to be empty.

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

    def parse(self, expr, simplify=False):
Severity: Critical
Found in ssg/ext/boolean/boolean.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

Either remove or fill this block of code.
Open

                pass

Most of the time a block of code is empty when a piece of code is really missing. So such empty block must be either filled or removed.

Noncompliant Code Example

for i in range(3):
    pass

Exceptions

When a block contains a comment, this block is not considered to be empty.

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

def print_report(current_dict: dict, baseline_dict: dict = None) -> None:
Severity: Critical
Found in utils/build_profiler_report.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

Unexpected additional newlines at the end of the file.
Open

Severity: Minor
Found in ssg/content_diff.py by editorconfig

Unexpected trailing spaces found.
Open

# Create and change to product_string dir 
Severity: Minor
Found in utils/build_profiler.sh by editorconfig

Unexpected trailing spaces found.
Open

    
Severity: Minor
Found in utils/rendering/common.py by editorconfig

Unexpected trailing spaces found.
Open

# Create and change to .build_profiling dir 
Severity: Minor
Found in utils/build_profiler.sh by editorconfig

Unexpected trailing spaces found.
Open

}    
Severity
Category
Status
Source
Language