Beispiel #1
0
def case_function_profane_parameter_name():
    code = """def f(gucking_parameter):
    return gucking_parameter + 1
    """
    reports = [
        ProfanityReport(
            error_id="JON102",
            line_number=1,
            message=(
                "Function parameter names should not include profanities. "
                'Found "gucking" in the name of a parameter of the function "f".'
            ),
        )
    ]

    return code, reports
Beispiel #2
0
def case_profane_expended_kwarg():
    code = """def f(**gucking_dict):
    return sum(gucking_dict.values())
    """
    reports = [
        ProfanityReport(
            error_id="JON102",
            line_number=1,
            message=(
                "Function parameter names should not include profanities. "
                'Found "gucking" in the name of a parameter of the function "f".'
            ),
        ),
    ]

    return code, reports