-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
[FR] A script which can be used in CI to check the formatting of XML docs files #145
Comments
Here's a summary of some of the questions discussed in the previous ticket:
This question was previously unanswered. In my opinion, I don't think the script should update the XML file. Showing the diff should be fine. Having said that, having a command parameter to optionally turn on fixing would be an interesting feature to add. IMO, this is not a requirement for the initial version of the script though, so it would be perfectly fine to open a ticket for this as "future scope" after the initial script has been merged.
|
Here are some follow up questions I've been thinking off. These are mostly related to the re-usability of the script. 1. Path parameterAs it appears to be possible to pass the path as a parameter, this now brings up the question of whether the script should be able to handle different types of "path" inputs ?, like:
The reason for thinking of this, is that a PHPCS package may contain multiple standards, like the PHPCS package itself has Having said that, again, this would be perfectly fine as something for "Future scope". 2. Check all XML files or only docs files ?As things are, the script looks to check all files with an However, this could run into trouble if someone would pass a "Standard" directory as that directory will also contain a Similarly, if someone would pass the project root, this would mean that So, this brings us to a choice:
3. Graceful error handlingAs the script will be distributed as re-usable, I think it may be good to throw an error if I seem to remember that the GH Actions images don't always come with xmllint pre-installed and that we have a 4. WindowsI can imagine that PHPCS package maintainers (like me) may have 5. GitHub Actions runner ?Last thing I'm thinking off and this ties a lot of the above together: would it be an idea to publish the script as a GitHub action runner ? Bear with me on this while I outline the idea:
To do so, the typical steps which need to be executed in GHA are like so:
Also see: https://github.com/PHPCSStandards/PHPCSDevTools/blob/develop/.github/workflows/cs.yml This repo already contains an XSD file for PHPCS docs files, this is typically used in GHA like so: An action runner could execute those steps automatically with the following inputs:
(input names open for discussion) That is providing the script is limiting itself to docs files and not other XML files. The action runner could potentially, at a later point in time, then also include the code sample check as proposed in #142 /cc @rodrigoprimo While this, again, could be something for "Future Scope", I think it might be good to have a think about this now anyway as, even if moved to "Future Scope", it would inform whether the script should be in a separate repo or in this repo. @viditagrawal56 What do you think ? Implementation details wise: |
Hey @jrfnl 👋
Yeah, I agree having an option like
I agree that supporting different types of path inputs would be beneficial, especially glob patterns. I think it is pretty doable
I think introducing a configurable parameter for the XMLLINT_INDENT setting to make it more generic would be great and pretty straight forward to implement. We just need to add a check for another option, lets say The command while execution will look like
Yeah Windows can be detected. bash has an environment variable
The idea of creating a GitHub Actions runner is fantastic. Though I don't have experience with GitHub Actions runners, I'm interested to learn and contribute to this project. I have a question about where the script should reside in this repo. Should it be in the root directory or in the scripts directory? If we decide to proceed with creating a GitHub Actions runner, we can then discuss creating a separate repository for it. Looking forward to your feedback and next steps! |
@viditagrawal56 Thank you for your response. Sounds like everything I came up with is doable, so that leaves us with some decisions to take and the fine print/implementation details to sort out.
If we'd go the GitHub actions runner route, we can lay out the (new) repo in whichever way works for its purpose. If we're talking this repo, the "entry point script" should be in the
I've never created a GH action runner from scratch, but I have contributed to a number of them, most notably to the Composer install action runner, which we could possibly use as an example. The Composer install action runner is a composite action, which means it's not written in Node, but runs other actions + runs some native bash scripts. It also has a test setup for bash scripts which we could probably re-use, which is why I think that project might be a good starting point. I suggest you may want to take a little time to study that repo (and possibly others) to gather your thoughts on this. There are only a few other action runners involving XMLint. None of which do what we need the action to do, though we could, again, have a look at them to see what we could learn from them. So I think to proceed, we'll first need to decide the following:
FYI: my availability/response time over the next two weeks will be minimal/slow as I'll be at the WCEU conference and doing some traveling around that. |
@jrfnl Really sorry for late reply I was busy with college work.
That sounds like a solid plan! I'll take some time to study Composer install action runner repo.
Thanks for letting me know. I understand. I'm definitely open to scheduling a video call to discuss the details further. Just let me know when would be convenient for you. Safe travels and enjoy the conference! |
@viditagrawal56 Good luck with your studies and take your time with having a look at the repos. Let's touch base again towards the end of June to schedule a videocall. Okay ? |
@jrfnl Thank you! That works perfectly. |
@viditagrawal56 I'm back and up and (nearly) caught up with my backlog by now. Are you still up for planning a call ? |
@jrfnl Sorry for missing our call and taking so long to respond. I'm still up for a call. I just need a bit of time to go over our previous conversations and the issue details again. How about we schedule the call for sometime next week? That way, I can be well-prepared and we can have a productive chat. |
@viditagrawal56 Next week sounds good. What timezone are you in ? I'm in CET. Would Tuesday July 30 work somewhere between 08:00 - 13:00 UTC ? |
@jrfnl I'm in IST (Indian Standard Time), so Tuesday, July 30th at 09:30 UTC would be 15:00 IST. That works for me! Let me know if that time fits your schedule. |
@viditagrawal56 Works for me. We can use whereby.com/jrfnl (no software install or login needed) for the call. |
@jrfnl Sure 👍 |
@jrfnl Hi, I am so sorry but I just found out that I need to go to college tomorrow for my final year project, so unfortunately, I won’t be able to make our meeting. |
@viditagrawal56 It happens, let's reschedule. How about Friday ? I can do any time between 07:30 - 14:00 UTC. |
@jrfnl Thank you for understanding! Friday should work, but I'll confirm as soon as possible. |
@jrfnl I’m really sorry for the short notice, but I’ll be busy with college on Friday. Would it be possible to reschedule our meeting to today at around 10:30 UTC? Let me know if that works for you. |
@viditagrawal56 Sorry, didn't see your message in time. |
@viditagrawal56 I'd still like to try and get this set up. Any chance we can try again planning a call ? |
Hi @jrfnl , I'd love to plan a call too, but due to college and the time zone differences, I have to attend college during regular working hours. Would it be possible to arrange a call on Sunday? I know it's a lot to ask to schedule a call during the weekend, and I'm really sorry for that. If that doesn't work, we could also schedule a call today anytime after 13:30 UTC. Let me know what works best for you! |
Hey @jrfnl, are you free for a call tomorrow, September 5th, anytime after 11:30 UTC? If so, we can setup a call |
@viditagrawal56 Okay, let's do this. Let's make it 12:00 UTC ? We can use [redacted]. |
@jrfnl Sure, that works! |
One of the things we discussed was maybe also adding different verbosity levels. I.e. the default being showing progress dots for each file scanned. Example (from PHPCS itself): |
Some good docs about creating actions can be found here: https://docs.github.com/en/actions/sharing-automations/creating-actions/about-custom-actions |
Is your feature request related to a problem?
XML docs for sniffs should have consistent formatting, but this can't currently be checked automatically as the
xmllint
+diff
commands need the file name of each individual file to be checked, which (without a script to provide those names) would mean the check in GH actions would need to be manually updated each time a docs file is added, which makes it fiddly and something which will easily go out of date/miss files which should be checked.This feature request was originally in the WPCS repo, but as it looks like it would be possible to handle this via a portable bash script, it would make sense to add that script to this package and make it available for (re)use by any PHPCS related repo which provides XML docs for sniffs.
Describe the solution you'd like
Additional context (optional)
In the original ticket, @viditagrawal56 has already posted an outline of a script which could be used for this and has indicated they would like to continue working on this feature.
This ticket is intended to talk through further implementation details for the feature.
The text was updated successfully, but these errors were encountered: