Skip to content

Conversation

@rekhajoshm
Copy link
Contributor

@rekhajoshm rekhajoshm commented Sep 15, 2018

What changes were proposed in this pull request?

Includes python document style checking.

  • Use sphinx like check, run only if pydocstyle installed on machine/jenkins
  • use pydocstyle rather than single file version pep257.py, which is much older and had some known issues
  • verify pydocstyle latest 3.0.0 is in use, to ensure latest doc checks are getting executed
  • ignore (inclusion/exclusion error codes) features and support via tox.ini
  • Be non-breaking change and allow updating docstyle to standards at easy pace

How was this patch tested?

./dev/run-tests

rekhajoshm added 20 commits May 5, 2015 16:10
Pulling functionality from apache spark
pull latest from apache spark
Pulling functionality from apache spark
Pulling functionality from apache spark
pull request from apache/master
pull latest from apache spark
pull latest from apache spark
pull latest apache spark
Apache spark pull latest
Apache spark latest pull
apache spark latest pull
Apache Spark master latest
@SparkQA
Copy link

SparkQA commented Sep 15, 2018

Test build #96086 has finished for PR 22425 at commit af83d90.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

Copy link
Member

@srowen srowen left a comment

Choose a reason for hiding this comment

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

I like the general idea, but this also turns off most checks? are there any that can be meaningfully re-enabled with a few fixes?

dev/tox.ini Outdated

[pycodestyle]
ignore=E226,E241,E305,E402,E722,E731,E741,W503,W504
ignore=E226,E241,E305,E402,E722,E731,E741,W503,W504,W605
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to exclude 605? I thought we fixed all those...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The intent of this PR was on pydocstyle changes, and this was pycodestyle break, so was unsure if that fix can be included in this PR. I had seen W605 code style broken in that build, and to make it pass added this. I agree completely the fix for W605 can be done with no-PR trivial fix., will check again.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm just confused why this would need to be changed in this PR -- hopefully just a hold over from the previous PR?

max-line-length=100
exclude=cloudpickle.py,heapq3.py,shared.py,python/docs/conf.py,work/*/*.py,python/.eggs/*,dist/*
[pydocstyle]
ignore=D100,D101,D102,D103,D104,D105,D106,D107,D200,D201,D202,D203,D204,D205,D206,D207,D208,D209,D210,D211,D212,D213,D214,D215,D300,D301,D302,D400,D401,D402,D403,D404,D405,D406,D407,D408,D409,D410,D411,D412,D413,D414
Copy link
Member

Choose a reason for hiding this comment

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

This is tiny, but is this blank line necessary? it seems to separate the heading from its content?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Between [pydocstyle] to ignore is necessary and standard style. Post ignore the blank line was added as per requested by last reviewer on previous PR - #20556 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think that's what @ueshin was asking for, I think it was a blank line after the ignore=..., but if @ueshin is around we can see what @ueshin says. It's also relatively minor provided everything functions.

Copy link
Member

Choose a reason for hiding this comment

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

I just asked to add a line break at the end of file, and the current style looks good to me.

Copy link
Member

@srowen srowen Oct 22, 2018

Choose a reason for hiding this comment

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

EDIT: disregard, there isn't a blank line, it's just github display confusing me. Oops, sorry about that.

Copy link
Member

@HyukjinKwon HyukjinKwon left a comment

Choose a reason for hiding this comment

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

I would also leave short explanations in PR description to justify why they should be skipped. Looks so many things are being skipped. FYI, this project does not yet claim PEP 257 as far as I know.

@rekhajoshm
Copy link
Contributor Author

rekhajoshm commented Sep 26, 2018

As per earlier discussions with prior reviewers, the intent of this PR was to make changes to enable pydocstyle but not to include all pydocstyle changes across all docs as that would need to be discussed later and be prioritized. I will relook at this again with your comments and check pydoc for style corrections.Thanks.

Sorry @srowen @HyukjinKwon , I was waiting from Feb2018 to Jul2018 on the previous PR #20556 , and hence there is a bit of disconnect from this issue. Plus bit caught up at work and hence delay in providing context in which this PR was created.

Copy link
Member

@srowen srowen left a comment

Choose a reason for hiding this comment

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

Ok I think it's fine to focus on enabling this tool here and then making changes later as we unexclude warnings.

I think we had separately fixed the w605 errors; might be worth checking if that's still needed.

Copy link
Contributor

@holdenk holdenk left a comment

Choose a reason for hiding this comment

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

Thanks for reviving this PR I'm excited to get better style checkers integrated into Spark. My main concern is with the change to pycodestyle's list of excluded problems.

max-line-length=100
exclude=cloudpickle.py,heapq3.py,shared.py,python/docs/conf.py,work/*/*.py,python/.eggs/*,dist/*
[pydocstyle]
ignore=D100,D101,D102,D103,D104,D105,D106,D107,D200,D201,D202,D203,D204,D205,D206,D207,D208,D209,D210,D211,D212,D213,D214,D215,D300,D301,D302,D400,D401,D402,D403,D404,D405,D406,D407,D408,D409,D410,D411,D412,D413,D414
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think that's what @ueshin was asking for, I think it was a blank line after the ignore=..., but if @ueshin is around we can see what @ueshin says. It's also relatively minor provided everything functions.

dev/tox.ini Outdated

[pycodestyle]
ignore=E226,E241,E305,E402,E722,E731,E741,W503,W504
ignore=E226,E241,E305,E402,E722,E731,E741,W503,W504,W605
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm just confused why this would need to be changed in this PR -- hopefully just a hold over from the previous PR?

@holdenk
Copy link
Contributor

holdenk commented Oct 19, 2018

Gentle ping, whats up?

@rekhajoshm
Copy link
Contributor Author

rekhajoshm commented Oct 19, 2018

Thank you @srowen @holdenk @HyukjinKwon for your review.

As per discussion, in this PR, we are enabling docstyle change but not updating pydocs. Hence tox.ini has doc error codes included.It can be taken off few at a time.

pydocstyle is newer correct way of handling doc style issues over pep257. It covers both pep257 and numpy convention style. http://www.pydocstyle.org/en/3.0.0/error_codes.html

updated pydocstyle to latest 3.0.0.
removed W605 from tox.ini. (the breaking codestyle error(W605) had appeared in the build when this branch was created, hence was quickly added to pass this, not lingering from old PR.)

@SparkQA
Copy link

SparkQA commented Oct 20, 2018

Test build #97621 has finished for PR 22425 at commit cba18e8.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Oct 22, 2018

Test build #97820 has started for PR 22425 at commit cba18e8.

echo "flake8 checks passed."
fi

# Check python document style, skip check if pydocstyle is not installed.
Copy link
Member

Choose a reason for hiding this comment

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

Nit: the indentation below looks different (4-space) from the rest of the script (2-space)

Copy link
Member

Choose a reason for hiding this comment

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

Actually, seems like indentation is inconsistent in this file, so let's leave it for now

max-line-length=100
exclude=cloudpickle.py,heapq3.py,shared.py,python/docs/conf.py,work/*/*.py,python/.eggs/*,dist/*
[pydocstyle]
ignore=D100,D101,D102,D103,D104,D105,D106,D107,D200,D201,D202,D203,D204,D205,D206,D207,D208,D209,D210,D211,D212,D213,D214,D215,D300,D301,D302,D400,D401,D402,D403,D404,D405,D406,D407,D408,D409,D410,D411,D412,D413,D414
Copy link
Member

@srowen srowen Oct 22, 2018

Choose a reason for hiding this comment

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

EDIT: disregard, there isn't a blank line, it's just github display confusing me. Oops, sorry about that.

@SparkQA
Copy link

SparkQA commented Oct 22, 2018

Test build #97844 has started for PR 22425 at commit cba18e8.

@SparkQA
Copy link

SparkQA commented Oct 22, 2018

Test build #97836 has finished for PR 22425 at commit cba18e8.

  • This patch fails to generate documentation.
  • This patch merges cleanly.
  • This patch adds no public classes.

@holdenk
Copy link
Contributor

holdenk commented Oct 26, 2018

I think the scaladoc error is unrelated, jenkins retest this please.

@SparkQA
Copy link

SparkQA commented Oct 26, 2018

Test build #98096 has finished for PR 22425 at commit cba18e8.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@srowen
Copy link
Member

srowen commented Oct 27, 2018

Merged to master. Anyone who feels like then addressing the style warnings, some that may be easy to address, go ahead.

@asfgit asfgit closed this in d5573c5 Oct 27, 2018
jackylee-ch pushed a commit to jackylee-ch/spark that referenced this pull request Feb 18, 2019
## What changes were proposed in this pull request?
Includes python document style checking.
- Use sphinx like check, run only if pydocstyle installed on machine/jenkins
- use pydocstyle rather than single file version pep257.py, which  is much older and had some known issues
- verify pydocstyle latest 3.0.0  is in use, to ensure latest doc checks are getting executed
- ignore (inclusion/exclusion error codes) features and support via tox.ini
- Be non-breaking change and allow updating docstyle to standards at easy pace

## How was this patch tested?
./dev/run-tests

Closes apache#22425 from rekhajoshm/SPARK-23367-2.

Authored-by: Rekha Joshi <[email protected]>
Signed-off-by: Sean Owen <[email protected]>
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.

6 participants