MySource Matrix Developer

Main Content

Snoopy Features

Verifying PHP Code

The main objective of Snoopy is to detect any violations against a defined set of coding standards in PHP code. Consistent and clean code is not only more readable, but also increases the efficiency of development and the quality of the product. Snoopy may not be an absolute solution, but it can help developers to fix many undesirable practices when writing PHP code.

Snoopy's functionality is not limited to syntactic checking, but also includes detecting common semantic errors produced by developers.

Furthermore, Snoopy's testing base is not limited to testing the coding standards enforced by the MySource Matrix development team. Tests can be written to validate the coding standards of any project. The Snoopy testing tutorial explains how to extend Snoopy's testing base and incorporate your own standards.

Coding Standard Generation

Apart from simply testing PHP code against a standard, Snoopy can also generate a PDF file of your coding standards to ensure they are visible to your developers and users.

The philosophy behind Snoopy's coding standard generation is that the documentation of what a particular test is trying to enforce resides along side the actual test. This means that a separate document encapsulating the entire coding standards set does not need to be maintained. Rather, it can be generated directly from the Snoopy tests.

See the Snoopy usage documentation for information on how to generate the coding standards PDF.

Self-Testing

Self-testing is a feature of Snoopy that allows the tests themselves to verify that they are working correctly. Self-testing is basically Snoopy's version of unit testing for the checking code.

The idea is that when you develop a test, you begin by writing a set of code blocks that both adhere to and violate the coding standard you are testing for. The test is complete when the self-testing procedure verifies that the code blocks that adhere to the coding standard pass, and those blocks that violate the coding standard fail.

If you discover a code block that violates a coding standard but your test is not reporting a problem with it, add the code block to the self-testing file and fix the test. Leaving the code block in the self-testing file ensures that code blocks like this one will always be detected.

See the Snoopy usage documentation for information on how to self-test Snoopy.