Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] Hide settings, to be null-ls friendly #166

Open
aemonge opened this issue Sep 12, 2024 · 6 comments
Open

[feature] Hide settings, to be null-ls friendly #166

aemonge opened this issue Sep 12, 2024 · 6 comments

Comments

@aemonge
Copy link
Contributor

aemonge commented Sep 12, 2024

To be able to integrate this on null-ls ( now none-ls ) as a editor diagnostics, we need to remove the header extra info.

I've "by-passed" it by wrapping it in:

pydoclint \
    --show-filenames-in-every-violation-message=true \
    -q "$@" \
    | awk '/^[^:]+:[0-9]+: / {print $0}' \
    | sort -u

But would be great to only show header (config info) if asked --info

@aemonge
Copy link
Contributor Author

aemonge commented Sep 12, 2024

@jsh9
Copy link
Owner

jsh9 commented Sep 12, 2024

Hi @aemonge , could you explain what you meant by "header extra info"? Maybe an example would help. Thanks!

@aemonge
Copy link
Contributor Author

aemonge commented Sep 12, 2024

Sure :)

Given a file like:

❯ cat a.py
def missing_doc(a: int, b: int = 2) -> int:
    """
    Missing doc

    Parameters
    ----------
    a : dict
        Azucar
    b : int, optional
        [default=2] Baron

    Returns
    -------
    int
    """
    return a + b

The current implemention outputs:

❯ pydoclint -q a.py
Loading config from user-specified .toml file: pyproject.toml
Found options defined in pyproject.toml:
{'style': 'numpy', 'exclude': '\\.git|\\.tox|tests|data', 'require_return_section_when_returning_
nothing': True, 'require_yield_section_when_yielding_nothing': False, 'treat_property_methods_as_
class_attributes': True, 'skip_checking_short_docstrings': False}
a.py
    1: DOC105: Function `missing_doc`: Argument names match, but type hints in these args do not 
match: a

And I expect a even more quiet version:

❯ pydoclint -q a.py
a.py
    1: DOC105: Function `missing_doc`: Argument names match, but type hints in these args do not 
match: a

So, --info would be the configuation and and config path, shown as "header":

❯ pydoclint -q a.py
Loading config from user-specified .toml file: pyproject.toml
Found options defined in pyproject.toml:
{'style': 'numpy', 'exclude': '\\.git|\\.tox|tests|data', 'require_return_section_when_returning_
nothing': True, 'require_yield_section_when_yielding_nothing': False, 'treat_property_methods_as_
class_attributes': True, 'skip_checking_short_docstrings': False}

@jsh9
Copy link
Owner

jsh9 commented Sep 29, 2024

So the messages come from these two lines:

print(f'Loading config from user-specified .toml file: {value}')

and

print(f'Found options defined in {tomlFilename}:')

I need to further learn how click passes config options. If you happen to be familiar with click, any help is welcome!

@aemonge
Copy link
Contributor Author

aemonge commented Oct 9, 2024

I'll give a shot next week, I'm familiar with click. So for sure I'll archive it, just need some spare time 😉

@aemonge
Copy link
Contributor Author

aemonge commented Oct 29, 2024

I've done the happy path work -> #178

The test are passing, checked using tox.

I didn't create a new test, since it needs to check for STDOUT and that a bit difficult to handle, if you need it I'll take my time and do it for you <3

Finally, I couldn't create a smoke test, since I don't know how to run the project locally (I'm more of a poetry dev, rather than a tox one). I've read the notes_for_developers.md but couldn't find a command to run this on ltye playground.py, if you can tell me how it would be lovely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants