Skip to content

Logic for checking if an API is commented out or not is flawed #66

Open
@nikkothari22

Description

@nikkothari22

The logic checks that before the @frappe.whitelist string are there an equal number of single/double quotes, or comment blocks (opening and closing) or not.

This fails when a comment might have an ' or " but no closing tag. (for example: the comment could be like:

Need to check the customer's ID

This would cause the API to be regarded as being inside a comment.

Possible solution: do not try to guess if the code is inside a comment or not - maybe have a flag that can tell the users that the API might be commented out, but still show the API on the UI. Or only test for triple strings only, and leave the single/double quotes from the logic.

Reference:

def is_in_string_or_comment(file_content, index):

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions