acquia / blt

Acquia's toolset for automating Drupal 8 and 9 development, testing, and deployment.
https://docs.acquia.com/blt/
GNU General Public License v2.0
442 stars 396 forks source link

DT-1531: Exclude directories from PHPStan / D9 validation #4117

Closed justclint closed 4 years ago

justclint commented 4 years ago

I want to... Exclude some directories from PHPStan / D9 validation check. Similar to how we can exclude file/directories in phpcs.xml.

I have 2 scenarios Im trying to solve for.

BLT Doctor output

+---------------------------+--------------------------------------------------------+
| Property                  | Value                                                  |
+---------------------------+--------------------------------------------------------+
| %paths.%root              | /var/www/project/docroot                               |
| %paths.%site              | sites/default                                          |
| %paths.%modules           | sites/all/modules                                      |
| %paths.%themes            | sites/all/themes                                       |
| %paths.%config-sync       | /var/www/project/config/default                        |
| %paths.%files             | sites/default/files                                    |
| %paths.%temp              | /tmp                                                   |
| %paths.%private           | /var/www/project/files-private                         |
| admin-theme               | seven                                                  |
| alias-searchpaths.0       | /var/www/project/drush/sites                           |
| base-profile              |                                                        |
| blt-version               | 11.4.0                                                 |
| bootstrap                 | Successful                                             |
| composer-version          | Composer version 1.8.6 2019-06-11 15:03:05             |
| config-sync               | /var/www/project/config/default                        |
| db-driver                 | mysql                                                  |
| db-hostname               | localhost                                              |
| db-name                   | drupal                                                 |
| db-password               | drupal                                                 |
| db-port                   | 3306                                                   |
| db-status                 | Connected                                              |
| db-username               | drupal                                                 |
| drupal-settings-file      | sites/default/settings.php                             |
| drupal-version            | 8.8.4                                                  |
| drush-alias-files.0       | /var/www/project/drush/sites/example.acsf.site.yml     |
| drush-alias-files.1       | /var/www/project/drush/sites/example.local.site.yml    |
| drush-alias-files.2       | /var/www/project/drush/sites/legacy.site.yml           |
| drush-alias-files.3       | /var/www/project/drush/sites/***-dev.site.yml      |
| drush-alias-files.4       | /var/www/project/drush/sites/***-prod.site.yml     |
| drush-alias-files.5       | /var/www/project/drush/sites/***-qa.site.yml       |
| drush-alias-files.6       | /var/www/project/drush/sites/***-ra.site.yml       |
| drush-alias-files.7       | /var/www/project/drush/sites/***-test.site.yml     |
| drush-alias-files.8       | /var/www/project/drush/sites/***.site.yml          |
| drush-cache-directory     | /home/vagrant/.drush/cache                             |
| drush-conf.0              | /var/www/project/vendor/drush/drush/drush.yml          |
| drush-conf.1              | /var/www/project/drush/drush.yml                       |
| drush-conf.2              | /var/www/project/docroot/drush                         |
| drush-conf.3              | /var/www/project/docroot/sites/default/local.drush.yml |
| drush-script              | /var/www/project/vendor/drush/drush/drush              |
| drush-temp                | /tmp                                                   |
| drush-version             | 9.7.2                                                  |
| files                     | sites/default/files                                    |
| install-profile           | lightning                                              |
| modules                   | sites/all/modules                                      |
| php-bin                   | /usr/bin/php7.2                                        |
| php-conf.0                | /etc/php/7.2/cli/php.ini                               |
| php-os                    | Linux                                                  |
| private                   | /var/www/project/files-private                         |
| root                      | /var/www/project/docroot                               |
| site                      | sites/default                                          |
| stacks.drupal-vm.inited   | true                                                   |
| stacks.dev-desktop.inited | false                                                  |
| temp                      | /tmp                                                   |
| theme                     | bootstrap_project                                         |
| themes                    | sites/all/themes                                       |
| uri                       | http://local.***.com                               |
+---------------------------+--------------------------------------------------------+
+----------------------------------------------+--------------------------------------------------------------+
| Check                                        | Problem                                                      |
+----------------------------------------------+--------------------------------------------------------------+
| ComposerCheck:composer.extra.installer-paths | The Composer configuration for extra.installer-paths differs |
|                                              | from BLT's default, recommended values.                      |
|                                              |   Change your configuration to match BLT's defaults in       |
|                                              |                                                              |
|                                              | vendor/acquia/blt/subtree-splits/blt-project/composer.json.  |
| NodeCheck:checkNodeVersionFileExists         | .nvmrc file exists                                           |
+----------------------------------------------+----------------------------

System information

Thanks!

lpeabody commented 4 years ago

Upstream request https://github.com/mglaman/drupal-check/issues/156

danepowell commented 4 years ago

Makes sense, however as you observed there's not much we can do unless the upstream library supports it first. In the meantime you could copy/override the BLT drupal-check command to use any arbitrary sets of directories (although you still won't be able to exclude directories).

mikemadison13 commented 4 years ago

we could potentially support an array of "to check" directories and then iterate through those. by default, we do modules/custom but we could do modules/custom/1 and modules/custom/3 but skip #2... would definitely tank performance but maybe that's ok? only those that need it would get it.

mikemadison13 commented 4 years ago

(so more explicit inclusion if using that feature by directory instead of supporting exclusion)

lpeabody commented 4 years ago

+1 to the above because we have several custom profiles in our project 🙏Easy enough workaround, we just run the command on our own in CI, but it would be nice not to have to run anything in addition to the BLT check command.

danepowell commented 4 years ago

Actually, we're going to move Drupal Check integration to a community-supported plugin.

Drupal Check integration has been extremely resource-intensive to maintain, and many folks seem to prefer alternative solutions, plus it's less valuable in BLT 12 (for Drupal 9) than it was in BLT 11 (preparing for the D9 migration). Thus, it's better suited for a plugin.

We'll post more notes closer to the BLT 12 release date, but any additional features would need to be submitted as a PR on the plugin.