-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Max line length #105
Max line length #105
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for taking this on @mdczaplicki. Very much appreciated!
I left some comments, let me know if you have any questions!
docs/usage.rst
Outdated
@@ -17,6 +17,7 @@ Current usage of ``pydocstringformatter``: | |||
[--capitalize-first-letter --no-capitalize-first-letter] | |||
[--final-period --no-final-period] | |||
[--quotes-type --no-quotes-type] | |||
[--max-line-length MAX_LINE_LENGTH] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems the CI fails here. You could try:
cd docs
make html
That should update the docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did that. Unfortunately pipelines still complain
@@ -0,0 +1 @@ | |||
--max-line-length 50 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this works. We might need:
--max-line-length 50 | |
--max-line-length=50 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, that's why :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I remember correctly it just reads all .args
files and splits on every space it encounters. Then it basically calls:
pydocstringformatter --max-line-length 50 test.py
. So these files should mimic how you would normally call the program on CLI
@@ -0,0 +1,13 @@ | |||
def func(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically the test should have 3 cases:
- One multi-line summary clearly above 50 characters. > Summary should be wrapped.
- One multi-line summary with a description above 50 chars. > Summary should be wrapped, but description shouldn't as we don't support that.
- One single-line docstring that is 49 chars without the final quotes. See
LinesChunk
.
If it is a single-line docstring we need to add the final quotes on the same line, so the line is not actually 49 but 52, so we should indeed wrap. That is whatLinesChunck
is testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Updated them. But for some reason it seems that 50
is not picked up in this test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is because the option doesn't use type
. You could add a breakpoint somewhere after line_length = self.config.max_line_length
but I think line_length
will now be "50"
instead of 50
. This can be fixed by using type=int
in the add_argument
call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It actually says that all docstrings are properly formatted. So it doesn't run
@@ -0,0 +1,2 @@ | |||
--linewrap-full-docstring |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mdczaplicki I have pushed some changes. Turns out I was being very dumb.
Since line wrapping is still experimental it is not enabled by default. So for the test to run, it also needs this flag set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem. Thanks for the help here :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries and thanks very much for doing the initial work. It's much easier as maintainer to build on a PR that's 90% done than starting from scratch.
Sorry for the spam you're getting right now. There is something wrong with one of our test runs but I can only test it on a PR opened by somebody that is not a contributor... I'll clean the commits in this PR up after I have fixed the issue and then merge this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests pass locally. 🎉
BTW. I believe there is a problem with make html
. I was running it, but pipelines complained.
Also:
❯ cd docs
❯ pip install -e .
Obtaining file:///home/marek/PycharmProjects/pydocstringformatter/docs
ERROR: file:///home/marek/PycharmProjects/pydocstringformatter/docs does not appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' found.
❯ pip install -r requirements-doc.txt
Obtaining file:///home/marek/PycharmProjects/pydocstringformatter/docs (from -r requirements-doc.txt (line 1))
ERROR: file:///home/marek/PycharmProjects/pydocstringformatter/docs (from -r requirements-doc.txt (line 1)) does not appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' found.
However it works when I go
cd ..
and then
pip install -r docs/requirements-doc.txt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it should be:
pip install -e .
cd docs
make html
This is due to how readthedocs
install dependencies from root. So we need to install them from root as well...
Pull Request Test Coverage Report for Build 2371300890
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One final spelling change.
I'm also using this PR to test some changes to the primer. Sorry for the merge commit spam 😅
0b51a74
to
b62e77f
Compare
This comment has been minimized.
This comment has been minimized.
According to the primer, this change has no effect on the checked open source code. 🤖🎉 |
Thanks once again @mdczaplicki, also for prompting me to final fix our CI 🎉 |
Small update to have max-line-length as a argument.
Sorry, but didn't have time to make tests pass. Some magic happens below 😛
Closes #90