Only symlink to the project's own files
Problem/Motivation
core/composer.json contains the following:
"extra": {
"drupal-scaffold": {
"file-mapping": {
"[project-root]/.editorconfig": "assets/scaffold/files/editorconfig",
"[project-root]/.gitattributes": "assets/scaffold/files/gitattributes",
"[project-root]/recipes/README.txt": "assets/scaffold/files/recipes.README.txt",
"[web-root]/.csslintrc": "assets/scaffold/files/csslintrc",
"[web-root]/.eslintignore": "assets/scaffold/files/eslintignore",
"[web-root]/.eslintrc.json": "assets/scaffold/files/eslintrc.json",
"[web-root]/.ht.router.php": "assets/scaffold/files/ht.router.php",
...As you can see, this is explicitly copying three asset files into the [project-root] directory: editorconfig, gitattributes, and recipes.README.txt. Note they are renamed when copied: editorconfig -> .editorconfig, gitattributes -> .gitattributes, and recipes.README.txt -> recipes/README.txt
The problem is, when testing contributed modules on GitLabCI, these files are moved into the contributed module directory. I do not need or want these files in my contributed module directory when testing - they serve no purpose and any spelling or coding standards problems in these files can and do cause my contributed module's tests to fail.
This came to my attention now that Drupal 11.1 has been released because recipes.README.txt actually DOES have a phpcs error in it which was causing a (new) phpcs error in my GitLabCI tests. This file didn't exist in Drupal 11.0 so this phpcs error didn't show up in contributed module tests using Drupal 11.0.
Steps to reproduce
Test a contributed module.
I don't know how to see what is copied into the contributed module directory on GitLabCI. However, if phpcs is enabled on .txt files for the contributed module, you will be able to see a phpcs error reported for [module-name]/recipes/README.txt.
Here is a specific example: https://git.drupalcode.org/project/typed_data/-/jobs/3852661
Proposed resolution
It is not sufficient to fix the phpcs error in the core file. That is being handled in the linked related issue. Instead, those core files should never be copied into the contributed module's directory during testing.
I have searched the gitlab_templates codebase. Although I see that [web-root] is being set, I don't see where [project-root] is being set. I think that when testing core, this probably defaults to the top-level drupal directory, where these files were intended to be placed.
But when testing contrib, [project-root] seems to default to the contributed module's directory instead, where these files do NOT belong.
The proposed resolution is then stop those files from being copied into the contribute module's directory. Perhaps this is a simple matter of defining [project-root] properly.
Related issue: Issue #3495586