kurtosis-tech / kurtosis-package-indexer

Crawls Github for Kurtosis packages
0 stars 1 forks source link

Docstring parser incorrectly parses args when there's no descriptions #58

Open tedim52 opened 10 months ago

tedim52 commented 10 months ago

Context: https://kurtosistech.slack.com/archives/C05DZ4UABDZ/p1699571012055539

mieubrisse commented 10 months ago

I dug into this more over the weekend. The problem comes from https://github.com/kurtosis-tech/starlark-lsp , and particularly the way that it does docstring parsing. The issue is in part because the current parsing ALWAYS treats the first non-empty line as the description, regardless of its contents. Therefore, if I do this:

    """
    Args:
        some_arg: Some arg description
    """

then the parser will think my description is actually:

Args:
some_arg: Some arg description

with some_arg: Some arg description being a continuation line of the "description" of Args:.

This happens because the docstring is first passed through normalizeLines and then passed through the args-extraction. The solution is to make the parser smarter, and intelligently identify when the first line is a description vs an Args descriptor block.

I've pushed some non-functioning work to this branch, but it was a naive approach and it will need more work.