Closed (fixed)
Project:
Droopler
Version:
5.0.5
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
31 Jan 2025 at 15:29 UTC
Updated:
5 Feb 2025 at 10:51 UTC
Jump to comment: Most recent
Comments
Comment #2
damian.skiba commentedComment #5
jonathan1055 commentedThanks for opening this issue. I have used it to test out some ideas about how to make phpcs ignore certain folders in a project's own directory structure. I created a
phpcs.xml.distfile in the project top folder, but it also required some customization in the actualphpcs: script:part of the pipeline. Here is a summary of the results, which shows in principle that this works:Added one phpcs fault. Added verbose
-vflag to show which files are now being checked. When the 'web' folder is correctly ignored there are just 16 files which are considered to contain php code. The log shows:https://git.drupalcode.org/issue/droopler-3503626/-/jobs/4209476
Without
-vverbose outputhttps://git.drupalcode.org/issue/droopler-3503626/-/jobs/4209827
Removed the forced error, all clean green
https://git.drupalcode.org/issue/droopler-3503626/-/jobs/4209839
MR18 is not ready for committing, because the customizations should really be done in Gitlab Templates, see #3380694: Add basepath parameter to PHP Code Sniffer so that paths are relative. When that issue is ready I will use this MR to test it.
Comment #6
jonathan1055 commentedI have found a simpler way for you to fix the phpcs and phpstan problems, and not have to pin your Gitlab Templates version to
1.6.14but allow you to return to using the default version. The recursion problems in PHPStan were due to this project having a/web/folder at the top of the project repository. This is a perfectly valid thing to do, and you do not need to change it. The problem is that the pipeline build process also creates a 'web' folder at top level. The name of this folder is arbitrary and we already provide a variable_WEB_ROOTto hold the value, which defaults to 'web'. But if you specify a different name in your .gitlab-ci.yml file then the problems do not occur.MR18 now demonstrates this - see the pipeline https://git.drupalcode.org/issue/droopler-3503626/-/pipelines/413632
The phpstan job runs and passes green.
The phpcs job now validly checks your project's 'web' folder, and we see
These are valid phpcs errors and warnings, they were not being reported previously because the "web" folder was being ignored (regardless of whether a project had their own or not). That problem was fixed in gitlab templates issue #3497525: Only symlink to the project's own files which is what exposed the problem you reported.
I have removed the testing changes, so MR18 is now ready for review
Comment #8
damian.skiba commentedThank you, Jonathan1055 and Fjgarlin, for your help with resolving the issue.
Comment #9
damian.skiba commentedComment #10
jonathan1055 commentedYou are welcome, and thank you for bringing the problem to our attention. We are working on a solution to detect when the project has a directory matching
_$WEB_ROOTand give an informative message in the log.Comment #11
grzegorz.bartman commented