Problem/Motivation
I maintain a bunch of modules including Structure Sync, and have spent quite a bit of time recently trying to figure out how to optimize my (very limited) contribution time. To this end, I've found a bunch of tools and developed a bunch of best-practices to make it easier for me to jump into maintaining a module. (Admittedly, some of this productivity comes from consistency with other modules I maintain, so there is some level of self-interest in this issue.)
Also, I've found that defining a "recommended" way to set up a development environment makes it easier to write documentation, and also make writing "Steps to reproduce" in issues easier (i.e.: because they can start from a defined starting point.
Therefore, I would like to propose the following changes to the code in the 2.x branch:
- Update the GitLab CI config for consistency and to take advantage of the community's latest changes
- Update
ddev/ddev-drupal-contribfor consistency and to take advantage of the community's latest changes - Fix some phpunit issues identified in my development environment
- Set up PHPStan (PHPStan is a tool that does static analysis on a codebase to find bugs. PHPStan is run in our CI pipeline. PHPStan groups its lints into rule levels - currently PHPStan doesn't report any issues because we don't have a configuration file for it yet)
Proposed resolution
- Update
.gitlab-ci.yml. Note the latest version at time-of-writing is 1.15.0. - Run the
ddev/ddev-drupal-contribsetup in this repo and commit the scaffolding to make setup easier. Note the latest version at time-of-writing is ddev/ddev-drupal-contrib 1.1.5. - Run
ddev phpcbfin the ddev-drupal-contrib environment to have it fix issues - Create
phpstan.neonandphpstan-baseline.neonfiles and update them to the highest level we can without errors. Initial tests suggest we can get it to level 1 right now.
Remaining tasks
Merge request- merge request !56 created by @mparker17 in #2- Community review
- Commit
- Release
User interface changes
None.
API changes
None.
Data model changes
None.
Issue fork structure_sync-3587224
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 #3
mparker17Seeing a test failure. I'll take a look at this.
Comment #4
mparker17Looks like there might have been some broken tests in the 2.x dev branch. I've fixed them here.
Now that all tests are passing, this is ready for review.
Comment #5
mparker17Since ddev doesn't install add-ons automatically, I just pushed a commit to delete
.ddev/addon-metadata/ddev-drupal-contrib/manifest.yamlso it doesn't show up as "changed" every time someone sets up the development environment.I should post the steps to test (which I will turn into a documentation page similar to a docs page I wrote for Elasticsearch Connector)...
First-time setup:
Before this issue is merged, you have to run:
But once this issue is merged, this step becomes simpler:
ddev config --autoddev add-on get ddev/ddev-drupal-contrib && ddev add-on get ddev/ddev-selenium-standalone-chromeddev startBefore working on an issue:
git switchto whatever branch/issue fork that I want to work onddev poser(this step is copied from the ddev-drupal-contrib Install instructions)ddev symlink-project(this step is copied from the ddev-drupal-contrib Install instructions)ddev drush -y si standardddev drush -y en structure_syncOut of scope for this ticket, but in the future, we should consider writing a test sub-module that sets up structure sync and some taxonomies, blocks, and menu links to test with.
ddev drush -y uliAfter making changes in an issue...
ddev phpcs,ddev phpstanddev phpunitddev exec "cd web/core && yarn install"We could make this part of the "Before working on an issue" setup
ddev eslint