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

Enable flake-docstrings to check for pep257 #621

Merged
merged 1 commit into from
Nov 12, 2019
Merged

Enable flake-docstrings to check for pep257 #621

merged 1 commit into from
Nov 12, 2019

Conversation

ssbarnea
Copy link
Member

@ssbarnea ssbarnea commented Nov 3, 2019

Enables checking of docstrings in order to assure compliance with
PEP257.

Because the codebase was never checked for this we are forced to disable
some of the rules and address them in follow-ups. This will ease code
reviews and avoid having too wide changes.

Signed-off-by: Sorin Sbarnea ssbarnea@redhat.com

tox.ini Outdated Show resolved Hide resolved
@@ -5,3 +5,5 @@ repos:
hooks:
- id: flake8
language_version: python3
additional_dependencies:
- flake8-docstrings
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- flake8-docstrings
- flake8-docstrings

@@ -5,3 +5,5 @@ repos:
hooks:
- id: flake8
language_version: python3
additional_dependencies:
- flake8-docstrings
Copy link
Member

Choose a reason for hiding this comment

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

Mind integrating pydocstyle too? http://www.pydocstyle.org/en/latest/usage.html#usage-with-the-pre-commit-git-hooks-framework

Suggested change
- flake8-docstrings
- flake8-docstrings
- repo: https://github.com/pycqa/pydocstyle
rev: 4.0.1
hooks:
- id: pydocstyle

Copy link
Member Author

Choose a reason for hiding this comment

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

flake8-docstrings is calling pydocstyle without the need to setup a new hook, not something else.

Copy link
Member

Choose a reason for hiding this comment

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

I'd argue that it's more illustrative as a separate check.

D104 # D104 Missing docstring in public package
D105 # D105 Missing docstring in magic method
D107 # D107 Missing docstring in __init__
# W503 is incompatible with W504
Copy link
Member

Choose a reason for hiding this comment

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

I think it's preferable to have binary operators in the beginning of next lines.

Copy link
Member Author

Choose a reason for hiding this comment

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

I am not against but the W504/W504 should be addressed in a separate PR due to its own complexity. The only reason picked one is because it needed only 2 minor changes and the other one would have needed >10-15 and not simple, some of them being hideous.

Copy link
Member

Choose a reason for hiding this comment

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

Okay, please make a separate issue for this then.

@ssbarnea
Copy link
Member Author

ssbarnea commented Nov 8, 2019

@webknjaz My impression is that we should disable building docs with py38 as is currently broken, I raised sphinx-doc/sphinx#6803 and I doubt is had anything to do with my change. I got the same error locally as on CI.

@webknjaz
Copy link
Member

webknjaz commented Nov 8, 2019

@ssbarnea that is correct. Python 3.8 under macOS specifically. But I haven't had time to figure out an elegant way to do this.

@webknjaz
Copy link
Member

webknjaz commented Nov 8, 2019

Ideally, we need a way to apply -j 0 just for that job.

@ssbarnea ssbarnea closed this Nov 11, 2019
@ssbarnea ssbarnea reopened this Nov 11, 2019
Enables checking of docstrings in order to assure compliance with
PEP257.

Because the codebase was never checked for this we are forced to disable
some of the rules and address them in follow-ups. This will ease code
reviews and avoid having too wide changes.

Fixes:

E126 continuation line over-indented for hanging indent
E123 closing bracket does not match indentation of opening bracket's line
D300 Use """triple double quotes"""
D400 First line should end with a period
W503 line break before binary operator

Signed-off-by: Sorin Sbarnea <ssbarnea@redhat.com>
@webknjaz webknjaz merged commit 017d1a2 into ansible:master Nov 12, 2019
@ssbarnea ssbarnea deleted the fix/flake8-docstrings branch July 26, 2020 07:19
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.

None yet

2 participants