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

Fix spacing between :rtype: and directives #294

Merged
merged 3 commits into from
Jan 16, 2023

Conversation

jakelishman
Copy link
Contributor

If the :rtype: field is being inserted immediately before a directive, we must ensure there is a blank line between the two to avoid a Sphinx warning.

Given that #290, which added this behaviour, already added a suitable test that emits a warning that doesn't fail the suite, I wasn't clear on how best to add a further test for this.

Fix #293.

If the `:rtype:` field is being inserted immediately before a directive,
we must ensure there is a blank line between the two to avoid a Sphinx
warning.
@jakelishman
Copy link
Contributor Author

I'm not clear why the docstring complexity flake8 is failing here, when I haven't touched the docstring.

Copy link
Member

@gaborbernat gaborbernat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test and make the CI pass.

@gaborbernat
Copy link
Member

cc @hoodmane

The extra nested if caused it to pop over the top of the configured
McCabe complexity measure.
@jakelishman
Copy link
Contributor Author

I added an assertion about the warning within the current testing setup, though it feels like a fairly fragile test. I'd generally have preferred to just have all warnings treated as errors (except explicit overrides) within that test, but there are other warnings that would be triggered, and I'm not so familiar with your testing structure to make that change.

To satisfy the complexity checker I had to completely split the containing function, rather than the more minimal change that's only in the first commit. The logical changeset is the same as 3966fb3, but it's hard to see from the diff.

@hoodmane
Copy link
Collaborator

+1 for whitelisting warnings to allow rather than blacklisting warnings to not allow.

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

Successfully merging this pull request may close these issues.

Invalid spacing between :rtype: and following directives
3 participants