Check Standards/Practice Coding And Linting
Installing Coder Sniffer and Drupal Check
Check Drupal Standard And Practice Coding
yarn phpcsFollowing with the Drupal core Coding standards
All Varbase components have a list of ready tools and script commands. That is to help contributors on the step of checking standards.
Please make sure to run the check and linting commands while contributing a new feature or a fix patch/MR.
Specifically, there are two rule sets, Drupal and DrupalPractice.
Before starting to check the code using phpcs or phpcbf
Follow with steps from Drupal.org docs on Installing Coder Sniffer
https://www.drupal.org/docs/contributed-modules/code-review-module/installing-coder-sniffer
Check Drupal standard and practice coding.
yarn phpcsFix many errors and warnings automatically.
Check all .yml files with Drupal standard yaml format.
Check all JavaScript .js, .json files with Drupal standard scripting format.
Check all styling .css files with Drupal standard styling format and order.
If you are using Lando, a local development environment, you can easily integrate PHPStan into your workflow. Follow these steps:
a. Open your terminal or command prompt and navigate to the root directory of your Drupal project.
b. Run the command lando phpstan to execute PHPStan analysis within your Lando environment.
c. PHPStan will analyze your codebase and provide a detailed report, highlighting any potential issues found.
d. Review the analysis results and follow the recommendations provided by PHPStan to address any identified issue
yarn phpcbfyarn lint:yamlyarn lint:jsyarn lint:css