Make maintenance easier: tooling updates
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3587208. --> Reported by: [mparker17](https://www.drupal.org/user/536298) Related to !13 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>I maintain a bunch of modules including CKEditor Abbreviation, 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.)</p> <p>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.</p> <p>To these ends, I would like to propose the following changes to the code in the 5.0.x branch...</p> <ol> <li>Update the GitLab CI config for consistency and to take advantage of the community's latest changes</li> <li>Install <code>ddev/ddev-drupal-contrib</code> (<a href="https://www.drupal.org/docs/official_docs/local-development-guide">Ddev is now Drupal's official development environment</a>. Its <a href="https://github.com/ddev/ddev-drupal-contrib">ddev/ddev-drupal-contrib</a> plugin makes developing/contributing to contrib modules a lot easier)</li> <li>Make it easier to use Drush to set up (i.e.: site-install) a ddev-drupal-contrib environment. (<a href="https://github.com/ddev/ddev-drupal-contrib?tab=readme-ov-file#install:~:text=Any%20development%20dependencies%20%28e%2Eg%2E%20Drush%29%20should%20be%20manually%20added%20to%20require%2Ddev%20in%20your%20project%27s%20composer%2Ejson%20file">in ddev/ddev-drupal-contrib</a> you install development dependencies by adding them to <a href="https://getcomposer.org/doc/04-schema.md#require-dev">the require-dev section in <code>composer.json</code></a>)</li> <li>Fix some eslint issues identified in my development environment</li> <li>Set up <a href="https://phpstan.org">PHPStan</a> (PHPStan is a tool that does static analysis on a codebase to find bugs. <a href="https://project.pages.drupalcode.org/gitlab_templates/jobs/phpstan/">PHPStan is run in our CI pipeline</a>. PHPStan groups its lints into <a href="https://phpstan.org/user-guide/rule-levels">rule levels</a> - currently PHPStan doesn't report any issues because we don't have a configuration file for it yet)</li> </ol> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <ol> <li>Update <code>.gitlab-ci.yml</code>. Note the latest version at time-of-writing is 1.15.0.</li> <li>Run the <code>ddev/ddev-drupal-contrib</code> setup 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.</li> <li>Add <code>"require-dev": {"drush/drush": "*"}</code> to <code>composer.json</code>. This will allow any version of drush that supports whichever version of core a user happens to be testing the ckeditor_abbreviation module with. </li> <li>Run <code>ddev eslint --fix</code> in the ddev-drupal-contrib environment to have it fix issues</li> <li>Create <code>phpstan.neon</code> and <code>phpstan-baseline.neon</code> files and update them to the highest level we can without errors. Initial tests suggest we can get it to level 5 right now.</li> </ol> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <ol> <li><del>Merge request</del> - <a href="https://git.drupalcode.org/project/ckeditor_abbreviation/-/merge_requests/13">merge request !13</a> created by @mparker17 (a maintainer) in <a href="https://www.drupal.org#comment-16567486">#2</a></li> <li><del>Community/Maintainer review</del> - done by @boromino in <a href="https://www.drupal.org#comment-16573654">#9</a></li> <li><del>Commit</del> - merged by @mparker17 in <a href="https://www.drupal.org#comment-16574867">#14</a></li> <li>Release</li> </ol> <h3 id="summary-ui-changes">User interface changes</h3> <p>None.</p> <h3 id="summary-api-changes">API changes</h3> <p>None.</p> <h3 id="summary-data-model-changes">Data model changes</h3> <p>None.</p>
issue