LilSpazJoekp / docstrfmt

A formatter for reStructuredText
MIT License
23 stars 13 forks source link

Feature Request: Set `--docstring-trailing-line` option from pyproject.toml #94

Open zachcran opened 2 weeks ago

zachcran commented 2 weeks ago

Describe the desired feature

Let me know if this feature already exists and I just missed it! I don't see a way to toggle whether there is a trailing line at the end of a docstring from a project pyproject.toml file. This is an option I would like to toggle for my entire project from one place.

I think adding a docstring_trailing_line = <bool> option under [tool.docstrfmt] in the pyproject.toml would work well from a user's perspective. It would make sense for it to have the same order of resolution as the line length option as well.

Additional Notes

~If you are open to adding a few options to the pyproject.toml, then I can make this a separate issue, but I wanted to let you know what I'm thinking:~

~- [ ] Looking through the command line options, the other options that I would potentially want to set project-wide are the exclude pattern options. I'm not sure the best way to do that one, but maybe exclude = [] and extend-exclude = [] lists would work? I don't know if it would get tricky if you mix command line args and pyproject.toml entries, though. In theory it should work smoothly if each option is resolved separately in the right order, but I don't have any idea about the implementation details...~

zachcran commented 2 weeks ago

I appreciate all of the quick responses and turnarounds, btw! I want to make sure to say that I absolutely am not expecting everything to be handled immediately; this flurry of issues and requests are just because I am getting excited, trying everything I can think of, and submitting a ton of issues and requests all at once as I come across them.

I am evaluating reST formatters for my work and personal projects, but I think docstrfmt is already in a suitable state for that!

LilSpazJoekp commented 2 weeks ago

Glad to hear it's working well for you thus far! Configuration settings are parsed and loaded into click. However, it seems that there is something broken with getting them passed to the main function. Like the others, I'll dig into this when I get a chance.

zachcran commented 1 week ago

Oh! I didn't know that other command line arguments could potentially be overloaded already. That is definitely worth documenting somewhere. Maybe I am just not setting the toggle for the docstring trailing line correctly, then. In theory, what would the correct line be in a pyproject.toml?

P.S. I went back and tried exclude = ["<patterns>"] and extend_exclude = ["<patterns>"] in my pyproject.toml and they seem to already work, so I struck through that part of the original issue.