What is a check?

Introduction

Checks are the core of this package, but unlike most static analyzers / linters, it doesn't come with any checks. You have to create them yourself.

There is enough information and examples in this wiki, so don't panic, but first, you should know what a check is and why it is so crucial that each team makes its own.

Checks must be very easy to create.

Building, maintaining, and testing checks becomes a chore when they become too complicated. With a simple approach of "find in the codebase", phecks will help teams make custom assertions on different folders, making users respect the correct folders, and follow the right patterns.

Checks can also access the runtime. They can run commands, run tests, or such. They can access the config, run commands, and if you configure it, you can also access the database.

Checks as a styleguide

Every mayor project should have a set of guidelines that developers must follow. These guidelines can go from "config keys must be written in snake_case" to "never perform a request validation outside of the Request class".

Following these styleguides will make the codebase more predictable, and they usually have a reasoning behind that is probably written in a Wiki page as an ADR.

Phecks is here to ensure that styleguides that can't be easily enforced by common static analysis tools, mess detectors or linting, don't make it to the main branch.

What Phecks is not

If you really want to cheat Phecks, you can. It won't do a full interpretation of your codebase or tokenize your classes. It will do a simple search and assert checks.

Why is that out of Phecks's scope? Since each team is responsible for making their checks, we can safely assume that Code Reviews are in place, and for more sneaky violations, other developers can help spot that.

It will take check-makers a lot more time to make checks so they are hack-proof. Way more time than the check is actually saving, which can defeat the purpose.

Phecks is meant to be used alongside static analysis, mess detectors and linters, not replace them.

Last updated