-
Notifications
You must be signed in to change notification settings - Fork 40
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
GHA: action thenabeel/action-phpcs seems unmaintained #5893
Comments
Not an expert at all in this @indigoxela, but what about https://github.com/marketplace/actions/action-php-codesniffer ? |
That's the (also) unmaintained action, our current one has been forked from. 😉 |
Isn't PHP_CodeSniffer a different Github action? |
That's a completely different and unrelated one, and we couldn't use it, as it runs on all code, which would produce masses of failures because of all our legacy code. |
That action checks all the files when the if (scan_all) {
files = await getAllFiles()
} else {
files = await getChangedFiles()
} |
Thanks, didn't see that. But that won't help, either. Think of a file like core/includes/common.inc with 8938 lines and 325 errors. |
I also experienced this issue in backdrop/backdrop#4349 I assume it's either the number of files that it can't handle, or it's the length of the generated command that breaks it. I looked into fixing it, wondering if instead of providing a list of filenames, we saved the list of filenames to a file and then told I tested this in my own repo and it worked. I then realised it was checking all files, not just the ones that were changed in the PR, so I found an action to get the list of changed files and passed that to Here's a PR: backdrop/backdrop#4355 |
@BWPanda many thanks for giving that a try. One difference between our current action and the one you chose (tj-actions/changed-files): the current one works with "changed-files" seems to work with ... yeah, well 😉 - which can lead to a lot of nagging when changing something in bigger files. That seems a bit hard for first-time-contributors. |
Even the currently used action reports |
@indigoxela I share your concern, but once we get our entire codebase through PHPCS and fix every pre-existing coding standard violation, then this will not matter as much. Right? So it may be throwing too many errors now, but these will slowly be reduced to practically only those changed by each PR. As it is currently, the PHPCS check fails randomly most of the time. So what we end up doing is to ignore it. We could do the same with the new GHA, but with this key difference: we create a separate PR to fix all errors with the files currently touched by the PR. We can keep ignoring PRs that touch a lot of files, and only action those that change up to say 4-5 files. That should slowly get us to a point where there are no complains by PHPCS. I mean, at some point we simply have to bite the bullet and fix everything anyway. Right? What do you think? |
Sure, just do what's necessary and you think is appropriate. 👍 |
I'm with @indigoxela that it's better to have it focus just on I'm not entirely clear on how it works. So long as it's just for the lines changed in the current PR. One thing I have noticed that is odd: currently if the PR branch is behind 1.x then it'll check all the commits between them. |
Yeah, I have also noticed that. I don't get as many failures once I rebase my PR branch. ...sometimes, the errors/failures go away if I just close/wait/reopen the PR. |
If the only realistic option is to check the whole changed file then that's what we've got, so I'm not going to block a change here. |
@indigoxela it's not what I think. One of our core committers started cleaning things up one module at a time in #3213, and the plan was for others to also help get things done. However, we didn't get very far (the https://github.com/backdrop/backdrop/tree/phpcs branch hasn't been touched in a long time). |
I'll have to dig deeper into how the current action works re. apparently only reporting on changed lines (and not whole files). The generated |
After doing a bit of research into this, I discovered that PHPCS doesn't support checking only changed lines in files:
(squizlabs/PHP_CodeSniffer#3111 (comment))
(squizlabs/PHP_CodeSniffer#678 (comment)) Some tools exist for this, such as https://github.com/123inkt/php-codesniffer-baseline and https://github.com/DaveLiddament/sarb (among others), but IMO that's just a hack to get PHPCS to do something it's not designed to do. This can be further seen in our own current implementation, as per the comments above:
The whole thing just seems hacky, broken, and hard to maintain. Not to mention, adding additional libraries/code to allow checking only changed lines adds more points of failure and increases the complexity of our tests. I therefore recommend we go with @klonos' suggestion to use PHPCS as intended and check whole files (that have been changed by the PR). Regarding the issue of new contributors being put-off by huge amounts of coding errors in code they didn't touch, we can either:
I'm actually leaning towards the latter... |
@BWPanda
I volunteer myself to help with these PHPCS-only PRs 🤚🏼 Here are some additional/alternative ideas for consideration that might also help:
The above will make it a bit easier for first-time contributors. PS: I plan to bring this up during the weekly dev meeting and see how others feel. |
@klonos I think you misunderstood... For the second option, I meant that we should mark this issue (#5893) as blocked and not merge my PR (to make these proposed changes) until the rest of the coding issues in core are fixed first. Then we can make this change and then it won't complain about existing code 'cause it'll all be fixed already. |
Sorry @BWPanda. Yes, I did misunderstand, so I've amended my reply. So OK, but fixing all of the issues in core all at once sounds like a big undertaking; and waiting for that to happen in smaller chunks over time will take a long time. In the meantime, we'll have to live with a dysfunctional/annoying PHPCS check. I certainly do NOT want to remove it though, since a check with false positives is better than no check at all. |
I'm leaning towards the 1st option: explain the situation to new contributors. Core committers can also edit the PRs to fix some of the errors before merging to help, so it's not just up to the contributor. |
I tried playing around with the code to see if I could get PHPCS itself to just check changed files from the PR (without needing the additional action for that), but couldn't get it working. So the PR is ready for review/testing if we want to go ahead with this. |
Description of the bug
Not actually sure, what's going on, but one PR just doesn't pass the phpcs check - for no obvious reason. And the phpcs output is odd. No annotations, but still a failure.
All the information we get is:
That reads like: "something went wrong, lol". Not really helpful.
What's different in this PR compared to the other (passing) ones: A lot more files changed (35). But that doesn't explain anything.
Now the problem: the action thenabeel/action-phpcs, which we use to only run checks on actually changed or added code seems unmaintained (by @thenabeel). It doesn't even have an issue queue enabled. And it's a fork of an also unmaintained action.
The action still runs based on nodejs 12, which is deprecated in GHA as of September this year.
https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/
Not sure, if this has impact here.
The action provides very little options to debug, so it's tricky to figure out what fails, anyway.
What are our options:
The text was updated successfully, but these errors were encountered: