# Check Standards/Practice Coding And Linting

{% hint style="info" %}
Following with the Drupal core Coding standards

<https://www.drupal.org/docs/develop/standards>
{% endhint %}

{% hint style="success" %}
All **Varbase components** have a list of ready tools and script commands. That is to help contributors on the step of checking standards.&#x20;

Please make sure to run the check and linting commands while contributing a new feature or a fix patch/MR.
{% endhint %}

## Installing Coder Sniffer and Drupal Check

Specifically, there are two rule sets, `Drupal` and `DrupalPractice`.

Before starting to check the code using `phpcs` or `phpcbf`

{% hint style="info" %}
Follow with steps from Drupal.org docs on Installing Coder Sniffer

<https://www.drupal.org/docs/contributed-modules/code-review-module/installing-coder-sniffer>
{% endhint %}

## Check Drupal Standard And Practice Coding

Check Drupal standard and practice coding.

```
yarn phpcs
```

## PHP Code Beautifier and Fixer&#x20;

Fix many errors and warnings automatically.

```
yarn phpcbf
```

## Linting YAML files

Check all `.yml` files with Drupal standard `yaml` format.

```
yarn lint:yaml
```

## Linting  JavaScript files

Check all JavaScript `.js, .json` files with Drupal standard scripting format.

```
yarn lint:js
```

## Linting Styling

Check all styling `.css` files with Drupal standard styling format and order.

```
yarn lint:css
```

## PHPStan

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.varbase.vardot.com/10.1.x/developers/extending-varbase/check-standards-practice-coding-and-linting.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
