Google Summer of Code; Second Evaluation

Ndubuisi Onyemenam
Studevs
Published in
3 min readAug 19, 2019

After the Community bonding period and first evaluations it was time to consolidate on gains made. My task for the second phase was to get Psalm to run on the civi-core repository on pull requests.

Background story; Psalm is a static analysis tool that checks a code base for errors without actually running the code. If integrated into a projects continuous integration tool chain Psalm can detect subtle errors before they are a merged. Having integrated Psalm on merge, it was time to get more proactive by integrating Psalm before merge i.e Pull requests.

After going through lots of google search results, I found this article helpful, and with it’s guide, I got the integration working.

Failing test Screenshot

I got Psalm working with pull requests; good, but the tests were failing as expected. Civi-core had lots of code and there was no way it would have been scanned without errors. The errors were in there thousands. While errors were helpful, there was need to have a feature that allowed for legacy errors to be tucked in and worked on overtime, while newer errors were fixed immediately. As my mentors made me understand, fixing thousands of errors wasn’t feasible for the development team, as there were feature requests for civi-core and some pertinent bug fixes that affected functionality.

Psalm Baslines to the Rescue

Psalm has a — — set-baseline flag which allows Psalm to grandfather older errors for later fixing while catching new errors for immediate fixing. With this feature , we (+2 to my mentors)had passing tests , yeah!

Passing tests

Making sense of a thousand errors

With the baseline functionality in place my mentors decided that some of the errors returned by Psalm were false negatives. These errors about missing dependencies and classes pointed to classes that were actually existing within civi-core. My mentors figured Psalm did not auto load some basic civi-core bootstrap files.

So begins my next task, to utilize a bootstrap file to reduce some of the false negative errors thrown by Psalm.

--

--

Ndubuisi Onyemenam
Studevs

Human @earth, PHP and Node.js Developer. Wait for more .... Hire me @onyemenamndu@gmail.com