DrupalCI is now codesniffing submitted patches, producing two types of reports, and a patch for any sniffs that can automatically be fixed:
https://dispatcher.drupalci.org/job/drupal_patches/2094/artifact/jenkins...
[02/12/2017 -:- 11:23:15 AM] <alexpott> Mixologic: having the patch there is amazing
[02/12/2017 -:- 11:23:35 AM] <alexpott> Mixologic: once there is a comment in the issue to it - this is game changing for committers
[02/12/2017 -:- 11:23:37 AM] <alexpott> Mixologic++
[02/12/2017 -:- 11:30:32 AM] <Mixologic> alexpott: cool. I can work with drumm to make that happen. should be trivial.
[02/12/2017 -:- 11:25:27 AM] <alexpott> Mixologic: nice the comment should link to the patch and the report
[02/12/2017 -:- 11:37:02 AM] <Mixologic> alexpott: which report, this: https://dispatcher.drupalci.org/job/drupal_patches/2094/artifact/jenkins... or this: https://dispatcher.drupalci.org/job/drupal_patches/2094/checkstyleResult/
So I never got a response from alexpott on that, but basically we have a few options: we can utilize the api to get at the checkstyle data, and have a report formatted exactly how we want it, or we can link directly to the command line output: https://dispatcher.drupalci.org/job/drupal_patches/2094/artifact/jenkins...
The patch is only going to be able to autofix those rules that have an autofixer created for them in coder, so it wont be a be-all end all, but will still be useful.
So not sure what the best design would be here, but we've got some options.
Comment | File | Size | Author |
---|---|---|---|
#29 | codesniffer patch link.png | 81.71 KB | jonathan1055 |
#12 | 2851916-12.patch | 3.27 KB | csg |
#10 | 2851916-10.patch | 3.24 KB | csg |
Comments
Comment #2
klausiIdeally proposed patches should be auto-fixed. If a patch is posted by a user with coding standard problems then the testbot should post a new patch with a comment "There, fixed some coding standard bullshit for you".
That would of course trigger another testrun - not sure how problematic it is that the testbot can trigger itself. It should probably only autofix patches that have not been posted by itself.
Comment #3
MixologicSo I think the ideal situation for a phpcs comprises the following:
1. a report of all the problems detected in the patch.
2. The submitted patch, with any problems autofixed
3. A patch of *just* the problems that were autofixed (i.e. an interdiff for review)
4. A report of any problems not autofixable - because there could still be problems.
#2. would allow us to not have to reroll patches, and should probably not be autotested, but should still have ad hoc testing buttons available.
We should probably consider what sort of output we would see if there were *more* linting/standards fixers ran (js/css/yaml/twig etc)
Im going to postpone this now until we have that second patch available in drupalci.
Comment #4
drummSplit that part off into #2852640: Allow not-previously-tested files to be tested.
Comment #5
drumm#2854700: DrupalCI: Display or link to checkstyle results on Drupal.org also got split off from this issue.
Comment #6
drummThe patches are ready for the taking now.
For branch tests, we should grab a copy of the file locally, and display a simple link to it. We don’t want to increase our reliance on Jenkins as a front-end.
For issue tests, we should either post a new comment as system message with the patch, or edit it into the existing comment next to the tested patch. I’m leaning toward existing comment, so the files don’t get too free-range.
Comment #7
drummWe should post the files from each tool (phpcs, eslint, csslint) separately.
Comment #8
Mixologiccss lint cant make patches fwiw, and I've gotta do some gyrations with eslint to produce a patch
Comment #9
Wim LeersWe're working on fixing this during Acquia Build Week's hackathon :) Sister issue for DrupalCI: #2881456: Phpcs: automatically generate patch to fix coding standards violations.
Comment #10
csg CreditAttribution: csg at Cheppers for Acquia commentedThis is what I have so far. Feedback is welcome.
Comment #11
Wim LeersThese should be the other way around. "autofix" is the actual patch, "fixes" is the interdiff.
Also, they're both URLs, so let's make them both have a
_url
suffix.Comment #12
csg CreditAttribution: csg at Cheppers for Acquia commentedFixed. Thanks for the review!
Comment #13
drummDo we want these patches to be testable by DrupalCI? From comment #3:
This would be done by putting the files in
field_issue_files
along with user-submitted patches. #2852640: Allow not-previously-tested files to be tested is the issue to make those and other untested patches testable.Comment #14
MixologicComment #15
MixologicComment #16
MixologicComment #17
MixologicComment #18
MixologicComment #19
xjm@drumm, for the MVP, we wanted the artifacts to just be linked and the issue marked NW with the early fail, so that contributors could find them on issues as soon as possible, since that will have immediate positive impact. Then we envisioned maybe posting and testing them as described a next step, since that has some more detailed requirements for repeated test runs, user expectation/design, etc. Do you think that would be doable? The sooner we help contributors find the artifacts directly on issue, the better, and then we can iterate based on actual contributor experiences. :)
Comment #20
xjmFor #12.
Comment #21
xjmJust to reiterate, it'd be really valuable to have just the NW comment linking the artifacts at first, so we can start changing our process for core contribution to match that. (Trivial issue credits are causing a lot of angst in the community right now and that angst in turn sucks up committers' time.)
I think once we adapt community process around that MVP, then we can work on and deploy making the reroll a testable attachment, with more scenarios and more complete design, to further reduce the manual steps needed.
Comment #22
Wim LeersOops, yes, I forgot to mark #12 NR again. I have no more comments on this patch.
The text was proposed by @xjm, implemented by @csg.
Comment #24
Mile23Pointing in the direction of #2881456: Phpcs: automatically generate patch to fix coding standards violations
Comment #25
drummCommitted & deployed with a couple changes:
Comment #26
xjmLooks good to me; thanks @drumm! Now to finish things from the CI side...
Comment #27
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedThis is great, thanks everyone. It worked nicely on a core coding standards error in #2068063-267: Change "Save and keep un-/published" buttons to a "Published" checkbox and an included "Save" button where a previous passing patch (which was about to be committed) had one cs fault.
Now I am looking forward to seeing this on contrib patches - currently we have no cs checking - #2870645: PHPCS is failing on contrib modules
Comment #28
xjmYay it works!
@jonathan1055, the marking issues NW solely for coding standards is not happening yet; that will be a part of deploying #2881456: Phpcs: automatically generate patch to fix coding standards violations once it is ready.
@drumm, one thing we noticed in testing, that could also have been part of the confusion above, is that the System Message comment does not link the CI result for the test fail, only a link to the comment which is disorienting and can be further confusing when there are multiple patches attached to a comment. Can we use this same mini-list to add a first bullet linking the actual test result? Posted #2883814: Link failing test result in System Message comment for failed patches for this.
Comment #29
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedOK, but here is the comment, with link to the newly generated patch.
Maybe the NW was generated by one of the random test fails we have been getting, but we certainly did get the codesniffer patch, with a single fix for coding standards, and when this was included in the patch it passed again - so that part is working nicely.
Comment #30
xjm@jonathan1055, yep, it was a random failure that caused it to be mark NW, and that happy coincidence surfaced the coding standards interdiff that's already available with the formatting that's just been deployed. :) That's why I proposed #2883814: Link failing test result in System Message comment for failed patches, so it would point people to the actual fails in the same comment as the coding standards info.
It's great to have part of it working already!
Comment #31
Wim LeersYAY! This is a small step, yet a big milestone :)