Integrating PHP_CodeSniffer (PHPCS) and PHPStan into a GitLab CI/CD pipeline helps maintain high code quality. PHPCS ensures adherence to coding standards, while PHPStan performs static analysis to identify potential issues. Running these tools automatically on every Merge Request (MR) helps catch code style violations and bugs early, promoting consistent and reliable code.

Now there are few problems:

FILE: markerio.module
------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------
39 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced with use statements
------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------

FILE: src/Form/SettingsForm.php
-----------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------
47 | WARNING | Possible useless method overriding detected
-----------------------------------------------------------------------------------------

Time: 81ms; Memory: 12MB

------ -----------------------------------------------------------------------------------------
Line markerio.module
------ -----------------------------------------------------------------------------------------
15 Function markerio_page_attachments() has no return type specified.
15 Function markerio_page_attachments() has parameter $attachments with no type specified.
------ -----------------------------------------------------------------------------------------

------ ------------------------------------------------------------------------------------------------------------------------------------
Line src/Form/SettingsForm.php
------ ------------------------------------------------------------------------------------------------------------------------------------
23 Method Drupal\markerio\Form\SettingsForm::getEditableConfigNames() return type has no value type specified in iterable type array.
💡 See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iter...
30 Method Drupal\markerio\Form\SettingsForm::buildForm() has parameter $form with no value type specified in iterable type array.
💡 See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iter...
30 Method Drupal\markerio\Form\SettingsForm::buildForm() return type has no value type specified in iterable type array.
💡 See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iter...
47 Method Drupal\markerio\Form\SettingsForm::validateForm() has no return type specified.
47 Method Drupal\markerio\Form\SettingsForm::validateForm() has parameter $form with no value type specified in iterable type array.
💡 See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iter...
54 Method Drupal\markerio\Form\SettingsForm::submitForm() has no return type specified.
54 Method Drupal\markerio\Form\SettingsForm::submitForm() has parameter $form with no value type specified in iterable type array.
💡 See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iter...
------ ------------------------------------------------------------------------------------------------------------------------------------

[ERROR] Found 9 errors

Issue fork markerio-3494396

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

anna d created an issue. See original summary.

anna d’s picture

Title: Setup Gitlab Pipelines & Code Standards » Setup Gitlab Pipelines CI/CD & Coding Standards with PHPStan and PHP_CodeSniffer

anna d’s picture

Status: Active » Needs review
rohan_singh’s picture

Status: Needs review » Needs work

Hi @anna d,

Everything looks good overall, but there’s a cspell issue reported in the pipeline.
Since it’s not significant enough to create a separate issue, it would be better to address it here.

Moving to Needs Work.

anna d’s picture

Status: Needs work » Needs review

macsim made their first commit to this issue’s fork.

macsim’s picture

Added a phpcs.xml to include PHPCS DrupalPractice standards. By default only the Drupal set of rules is used

tijsdeboeck’s picture

Thanks for the contribution, we'll work on the module in the coming weeks, and test and merge this one too.

tijsdeboeck’s picture

Status: Needs review » Fixed

Merged, new release is available (1.0.5)

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

tijsdeboeck’s picture

Status: Fixed » Closed (fixed)