Skip to content

Black formatting preparation #3314

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

Merged
merged 4 commits into from
Nov 12, 2020
Merged

Conversation

clacroix12
Copy link
Contributor

This PR fixes various issues that were causing pre-commit to fail after formatting the repo with black. These failures were coming up now because pre-commit runs against files in your changeset and not against the entire repository. These problems existed before black formatting was being done.

Signed-off-by: Coady LaCroix <[email protected]>
Signed-off-by: Coady LaCroix <[email protected]>
@clacroix12 clacroix12 added the team/ecosystem Ecosystem team related issues/PRs label Nov 12, 2020
@clacroix12 clacroix12 requested a review from a team as a code owner November 12, 2020 17:36
@pull-request-size pull-request-size bot added the size/M PR that changes 30-99 lines label Nov 12, 2020
# cluster access as well.
#
# For more details, see `GCP documentation on ServiceAccountKey resource
# <https://cloud.google.com/iam/docs/reference/rest/v1/projects.serviceAccounts.keys>`_
Copy link
Contributor

Choose a reason for hiding this comment

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

Would this change preserve this docstring in our sphinx build?

Right now, it's part of our documentation as expected: https://ocs-ci.readthedocs.io/en/latest/apidoc/ocs_ci.utility.html#ocs_ci.utility.gcp.SERVICE_ACCOUNT_KEY_FILEPATH

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, this I'm not sure of. Right now it's causing the following error in our check-docstring-first hook:

Check docstring is first.................................................Failed
- hook id: check-docstring-first
- exit code: 1

ocs_ci/utility/gcp.py:29 Multiple module docstrings (first docstring on line 2).

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can check the docs from this build and resolve it if it looks good

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is actually an open issue for this pre-commit/pre-commit-hooks#159 with a potential fix that has yet to be merged. It may be worth reconsidering the use of check-docstring-first until that is fixed if we want to use attribute docstrings.

Copy link
Contributor Author

@clacroix12 clacroix12 Nov 12, 2020

Choose a reason for hiding this comment

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

Actually, looks like there may be a workaround for this: pre-commit/pre-commit-hooks#159 (comment). I'll try to test this out.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is a bug in check-docstring-first, likely pre-commit/pre-commit-hooks#159 - as you can see in the html sphinx build, both module docstring and variable docstring are present as expected.

I suggest to disable this particular hook.

Copy link
Contributor Author

@clacroix12 clacroix12 Nov 12, 2020

Choose a reason for hiding this comment

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

Yeah, I have tried to use the #: syntax workaround but it doesn't seem to work for me. I'm not seeing any attribute doc unless I go with the triple quote docstring method.

I suggest to disable this particular hook.

I agree, I am going to revert the change to this docstring and disable the check entirely.

@clacroix12
Copy link
Contributor Author

@vasukulkarni @mbukatov I have reverted the change to that particular docstring and removed check-docstring-first from our pre-commit hooks. I don't think it offers enough for us to limit our documentation for it.

@clacroix12 clacroix12 merged commit 718c7ac into red-hat-storage:master Nov 12, 2020
@clacroix12 clacroix12 deleted the black-prep branch November 12, 2020 18:56
prsurve pushed a commit to prsurve/ocs-ci that referenced this pull request Feb 5, 2021
* Flake8 ignore E203
* Fix flake8 issues
* Fix check-docstring-first failures
* Remove check-docstring-first pre-commit hook as it doesnt support using sphinx attribute docstrings

Signed-off-by: Coady LaCroix <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/M PR that changes 30-99 lines team/ecosystem Ecosystem team related issues/PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants