Do you read your code before running to make sure it would work? Do you see if that variable was initialised, or if you included a return statement? Do you also see if the code follows Drupal coding standard? If you answered yes to any of the above, you are statically analysing your code in your head.
But your brain doesn’t scale, nor are you capable of checking hundreds of lines of code with every commit. Use your brain for better things and leave static analysis to tools designed for that purpose.
You might have used PAReview for your Drupal modules to verify that your code is clean and follows coding standards. It is easy to forget to run it before each commit. Do yourself and the poor soul who has to review your merge request a favour and automate!
In this session, you will learn:
What is static analysis?
More about PAReview
Why can’t you use PAReview in a CI environment?
Tools like phpcs, phpmd, phpstan, stylelint, eslint, etc…
Integrating these tools with gitlab with a Docker image designed for this purpose