Still on Drupal 7? Security support for Drupal 7 ended on 5 January 2025. Please visit our Drupal 7 End of Life resources page to review all of your options.Problem/Motivation
Hi,
composer-lint job fails while it says that composer.json is valid: https://git.drupalcode.org/project/sobki_theme_admin/-/jobs/1181958
Proposed resolution
The job fails on projects where there are no files that match .php, .inc, .module or .install
So the job can check for the existence of atleast one of these before running parallel-lint
Update doc page
Here is a view of how the updated doc page will appear
https://git.drupalcode.org/issue/gitlab_templates-3436819/-/blob/3436819...
Issue fork gitlab_templates-3436819
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
jonathan1055 commentedIs it giving a failiing exit code because there are no files to check? Maybe there is some kind of
--no-files-no-failureoption to set, like there is on other linting jobs?Alternatively we test for the existence of one of those types of files, and don't run the parallel-lint call if there are none?
Comment #3
jonathan1055 commentedOne option would be to add
to the job, but that would not allow your checking on composer.json, because the job would not get added in the first place. Maybe it's better to check for the files within the script.
Comment #5
jonathan1055 commentedUntested. No idea if this is going to work. It does display the files locally, so that will need to be tidied up.
Comment #6
jonathan1055 commentedI've worked out a solution, and this is now ready for review. To give some backgroud, using Scheduler as my test module, the current job gives
I used
findto check if there are any files with extensions php,module,install or inc, but this returned all the php in the vendor folders. Then I thought about changing directory to modules/custom/{project} to count the php files there. But running parallel-lint there givesOnly four files were tested, not 136. After a bit of investigation I realised that these four are the only matching files in the project top-level folder, all the rest are sub-folders src, tests, etc. The parallel-lint command does not follow symlinked files in sub-folders, but it could read the four symlinked files at the top level. To verify this I used
which finds nothing. But changing
-type fto-type lto look for symlinks and we get the four top-level files.and these four files must have been the only ones tested by parallel-lint. The results of all of the above with extra output can be seen in this test job https://git.drupalcode.org/project/scheduler/-/jobs/1201071
This shows me that we have to run parallel-lint at the root folder /projects/build/{project} - which is where it is done now. Therefore we search/count php files in
$CI_PROJECT_DIR/$_WEB_ROOT/modules/custom/$CI_PROJECT_NAMEbut we do change directory, we run parallel-lint in the same place as now.find -L $_WEB_ROOT/modules/custom/$CI_PROJECT_NAME -type f | grep -E '\.(php|module|install|inc)$'does the checking. The addition of the-Largument is to allow find to follow symlinks, and this gives the correct number of files in the project.Here's a test running MR168 with the new additions uncustomised.
https://git.drupalcode.org/project/scheduler/-/pipelines/133829
Here is a test showing what happens when no files are found (I just added ZZZ into the patten to ensure no match)
https://git.drupalcode.org/project/scheduler/-/pipelines/133802
Comment #7
jonathan1055 commentedI have tested this using sobki_theme_admin, the project for which Grimreaper raised this issue.
The issue is #3436970: Gitlab pipeline testing and MR is https://git.drupalcode.org/project/sobki_theme_admin/-/merge_requests/1
The parallel-lint job now passes not fails, and log says
See https://git.drupalcode.org/issue/sobki_theme_admin-3436970/-/jobs/1201439
Comment #8
grimreaperThanks a lot @jonathan1055!
One small comment on my review.
Could be RTBC from what I see on #3436970: Gitlab pipeline testing, but not changing the status as I think it needs a review from another maintainer.
Comment #9
fjgarlin commentedHappy for the
pwdcommand to stay.This looks great. Thanks also for the testing on project with and without files to run this parallel-lint job on.
RTBC, will probably commit it later today.
Comment #10
jonathan1055 commentedThanks. I just rebased again (no conflicts).
Are you OK with the added
--show-deprecatedparameter?Comment #11
fjgarlin commentedI'd rather remove it and add it as part of the documentation as it can easily be set via _PARALLEL_LINT_EXTRA.
Moving to Needs work, but once that's removed and the documentation page has been updated it can go back to RTBC (or Needs review and I can give it a final review).
Comment #12
jonathan1055 commentedYes, ok. I have removed the parameter and updated the docs. Here's the new page. I made a few other additions to it. Is there anything else to add whilst we are on this job?
https://git.drupalcode.org/issue/gitlab_templates-3436819/-/blob/3436819...
Comment #13
fjgarlin commentedI made a really minor suggestion to the documentation file (mostly wrapping things around backticks as it renders nicely in markdown), but everything is great and ready to be merged.
I can apply that suggestion before merging or you are free to do it if you think it's valid.
RTBC.
Comment #15
fjgarlin commentedMerged, thanks so much!