DX: Faster feedback loop: stop running `phpstan` twice for local development: ~30s → ~15s, only run twice on CI instead (currently 4!)
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3591249. --> Reported by: [wim leers](https://www.drupal.org/user/99777) Related to !1139 >>> <h3 id="overview">Overview</h3> <p><span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/canvas/-/work_items/3591245" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/canvas/-/work_items/3591245</a></span> improves the DX, and makes it consistent between PHP (<code>composer run &hellip;</code>) and everything else (<code>npm run &hellip;</code>).</p> <p><span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/canvas/-/work_items/3538439" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/canvas/-/work_items/3538439</a></span> introduced <code>composer run phpstan</code> and immediately optimized it for running on CI: it set up caching, then runs it <em>twice</em>.</p> <p>(Meaning the intent is the same as <span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/canvas/-/work_items/3589565" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/canvas/-/work_items/3589565</a></span>: optimize this for developer use, rather than CI.)</p> <h3 id="proposed-resolution">Proposed resolution</h3> <p>Make <code>composer run phpstan</code> run it only <em>once</em>, this makes a very noticeable difference (with caches primed, i.e. as you would use this during development):</p> <dl> <dt>HEAD: ~30 seconds</dt> <dd> <pre>$ time composer run phpstan<br>&hellip;<br>real 0m18.920s<br>user 0m7.768s<br>sys 0m12.244s</pre></dd> <dt>MR: ~15 seconds</dt> <dd> <pre>$ time composer run phpstan<br>&hellip;<br>real 0m8.723s<br>user 0m3.655s<br>sys 0m5.315s</pre></dd> </dl> <h3 id="ui-changes">User interface changes</h3> <p>None.</p>
issue