Maintaining code quality on projects where there are many developers contributing is a tough assignment. How many times have you tried to contribute to an open-source project only to find the maintainer rejecting your pull request on the grounds of some invisible coding standard? How many times as a maintainer of an open-source project (or internal) have you had a hard time reading code because there were careless tabs/spaces mixed, if statements with no brackets, and other such things. Luckily there are tools that can assist maintainers. In this post, I’ll be going over how to use composer, git hooks, and phpcs to enforce code quality rules.
After the release of some of our libraries, such as Symbiosis, MongoUnit and CSV Policy, we are proud to announce our newest open source project: Json Serializer. The Json Serializer–as the name suggests–serializes content in JSON format. It is a very simple concept, but very useful in some cases.
Our tech team uses a process similar to the Github Flow, whereby all changes are pushed to the main branch of a repo by way of Github pull requests. We use this internally, but it is also the most common mechanism for open source projects to get community contributions on Github. We think it’s a great way to encourage code reviews and incremental improvements prior to going into a main production pushable branch, however it’s not without its pain points.
While experimenting with Node.js for a coding game we are working on called Node Defender1 for the Ultimate Developer Conference, many asynchronous problems arose that we were unaccustomed to dealing with since we are primarily a PHP shop (read: synchronous). The examples covered in this post are specific to MongoDB, but the essence can be applied to any asynchronous process.