Uh oh!
There was an error while loading. Please reload this page.
[BEAM-10771] Added a whitespace lint as part of python lint precommit - #12444
Conversation
There was a problem hiding this comment.
a bit strange to apply this only when there is a python change. md files could be anywhere in the repo.
There was a problem hiding this comment.
Yes, it makes sense to put it at the root.
I've made a new task to run the tool in a python virtual env, but for all files.
It'll be triggered if there are markdown files or build.gradle files changed.
nika-qubit
commented
Aug 1, 2020
Did a rebase to take in the trailing whitespace fix of a README from a previous PR. |
aaltay
commented
Aug 3, 2020
LGTM. Would it make sense to announce this on the dev@ list? Or do you think this is will sufficiently have minimal impact. |
nika-qubit
commented
Aug 3, 2020
Once we merge it, I'll check if new PRs would trigger it as expected and update the README of Jenkins trigger phrases. |
nika-qubit
commented
Aug 3, 2020
Run Python2_PVR_Flink PreCommit |
1 similar comment
nika-qubit
commented
Aug 3, 2020
Run Python2_PVR_Flink PreCommit |
There was a problem hiding this comment.
Is it possible to limit the trigger pattern to *.md and build.gradle files only? (The task is checking only for those files anyway.)
There was a problem hiding this comment.
R: @damgad
Hi Damian, sorry to bother you on this PR. Tyson told me you might be able to give some advice on this topic: does this regex look fine to you and could we test it before merging it? Thanks!
There was a problem hiding this comment.
Hey, no worries. The regex looks fine, and I've also checked that it works. FYI: by running the seed job from the PR you can see your changes in action on Jenkins. However (practically) only committers could trigger that.
There was a problem hiding this comment.
Thanks, this is really helpful information!
nika-qubit
commented
Aug 4, 2020
Run Python2_PVR_Flink PreCommit |
There was a problem hiding this comment.
I suggest whitespacelint "$FILE" to correctly handle whitespaces and prevent globbing.
damgad
commented
Aug 5, 2020
run seed job |
damgad
commented
Aug 5, 2020
Run Whitespace PreCommit |
damgad
left a comment
There was a problem hiding this comment.
Few things regarding this change
Isn't the spotless pre-commit right place to extend with such checks? Many developers probably already added that to their pre-commit hooks so the introduction of this check will be almost unnoticeable.
Seems like it's using python2.7 virtualenv [1]:
00:00:40.125 Running virtualenv with interpreter /usr/bin/python2.7
00:00:40.425 DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020.
If possible, I would suggest avoiding that due to the end of life.
- The check is really "quiet" in terms of logging, in case of failure there are no details regarding the file/line and the exact issue. Check out my sample PR #12470 and the build output [2]. Would be helpful if it prints the issue similarly to the spottles e.g. [3].
[1] https://ci-beam.apache.org/job/beam_PreCommit_Whitespace_Commit/1/console
[2] https://ci-beam.apache.org/job/beam_PreCommit_Whitespace_Commit/3/console
[3] https://ci-beam.apache.org/job/beam_PreCommit_Spotless_Commit/10575/console
There was a problem hiding this comment.
Hey, no worries. The regex looks fine, and I've also checked that it works. FYI: by running the seed job from the PR you can see your changes in action on Jenkins. However (practically) only committers could trigger that.
nika-qubit
commented
Aug 11, 2020
It will be the best if the check is unnoticeable. This check can also get triggered when a commit only changes some markdown or build.gradle files in the repo. It's not needed if the commit just changes code since different linters in those programming languages already covers the whitespace issues in code files.
Changing it to use python3.8.
Yes, it doesn't print much except I'll modify the script to output more information. |
aaltay
commented
Aug 14, 2020
@kevingg - one suggestion, separate the update md files to a single commit and people can review infra changes without reviewing all the md file changes. |
nika-qubit
commented
Aug 14, 2020
Got it, will rebase it into 2 separate commits. |
9bd0f5d to
c494469Comparenika-qubit
commented
Aug 14, 2020
This PR now contains 2 commits and the first commit contains test infra changes. |
nika-qubit
commented
Aug 14, 2020
Run Python2_PVR_Flink PreCommit |
1 similar comment
nika-qubit
commented
Aug 14, 2020
Run Python2_PVR_Flink PreCommit |
nika-qubit
commented
Aug 14, 2020
The tasks failed at |
aaltay
commented
Aug 14, 2020
Run Python2_PVR_Flink PreCommit |
nika-qubit
commented
Aug 17, 2020
Run Python2_PVR_Flink PreCommit |
nika-qubit
commented
Aug 17, 2020
Run PythonDocker PreCommit |
nika-qubit
commented
Aug 17, 2020
Run PythonDocs PreCommit |
nika-qubit
commented
Aug 17, 2020
R: @pabloem |
pabloem
left a comment
There was a problem hiding this comment.
Can you create a Jira issue for this?
There was a problem hiding this comment.
did you find that you needed the mustRunAfter rules even though you also had the dependsOn rules?
There was a problem hiding this comment.
Removed the mustRunAfter statements.
There was a problem hiding this comment.
Can you add mention of this job in .test-infra/jenkins/README.md? probably also in the PR template tables, please
There was a problem hiding this comment.
Can you document in this file which groups of files are meant to be linted by this test?
It is triggered on changes of any markdown or gradle build file in the Beam repo.
Created BEAM-10771 for this. |
f2d3040 to
4e573fdComparenika-qubit
commented
Aug 20, 2020
Rebased to catch up with the HEAD. Edited two more new files with whitespaces. |
nika-qubit
commented
Aug 20, 2020
Run Java PreCommit |
nika-qubit
commented
Aug 20, 2020
Run Python PreCommit |
pabloem
commented
Aug 21, 2020
Run Seed Job |
pabloem
commented
Aug 21, 2020
LGTM. I'll just run the seed job to verify the jenkins config. |
pabloem
commented
Aug 21, 2020
Run Seed Job |
2 similar comments
pabloem
commented
Aug 21, 2020
Run Seed Job |
pabloem
commented
Aug 21, 2020
Run Seed Job |
pabloem
commented
Aug 21, 2020
Thanks @kevingg . Can you please make a follow up change to include it here: https://github.com/apache/beam/blob/master/.github/PULL_REQUEST_TEMPLATE.md so it will show up in the PR template? |
1. The job was created in apache#12444. 2. Its cron job is not enabled on Jenkins, thus no status is available in the template at this time.
Added a Jenkins whitespacePreCommit that now lints whitespace for markdown files and gradle build files in the repo.
Triggered whenever files under sdks directory are changed.
Whitespace lint for other non code files can be added in this way too.
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
R: @username).[BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replaceBEAM-XXXwith the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.CHANGES.mdwith noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.
Post-Commit Tests Status (on master branch)
Pre-Commit Tests Status (on master branch)
See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.