Fix coding standards

Created on 28 May 2024, about 1 month ago
Updated 3 June 2024, 25 days ago

Problem/Motivation

Fix the coding standards that are failing in the GitLab CI pipeline. This includes two declare strict_types that are not in the proper format. It also fixes the module description in the info.yml, which has a typo and therefore does not display the description in the module listing in the UI.

Steps to reproduce

See https://git.drupalcode.org/project/masquerade_log/-/merge_requests/6

Also, view the module in the list at /admin/modules, and see that the description doesn't show.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ“Œ Task
Status

Needs review

Version

1.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
  • Coding standards

    It involves compliance with, or the content of coding standards. Requires broad community agreement.

Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @solideogloria
  • Status changed to Needs review about 1 month ago
  • Pipeline finished with Failed
    about 1 month ago
    Total: 171s
    #184428
  • Status changed to Needs work 26 days ago
  • πŸ‡΅πŸ‡­Philippines clarkssquared

    Hi

    I checked the GITLAB CI in your MR !7 and the PHPCS still failed and this is the issue the GITLAB reported:

    Running with gitlab-runner 16.11.0 (91a27b2a)
      on gitlab-prod-runner-gitlab-runner-5d6b64f896-rz4f2 _hJ-7HCk, system ID: r_Z0MqGKHApPJk
    Resolving secrets
    Preparing the "kubernetes" executor
    00:00
    "CPURequest" overwritten with "2"
    Using Kubernetes namespace: gitlabci-prod
    Using Kubernetes executor with image drupalci/php-8.1-apache:production ...
    Using attach strategy to execute scripts...
    Preparing environment
    00:31
    Using FF_USE_POD_ACTIVE_DEADLINE_SECONDS, the Pod activeDeadlineSeconds will be set to the job timeout: 1h0m0s...
    Waiting for pod gitlabci-prod/runner-hj-7hck-project-62103-concurrent-1-ug74h61m to be running, status is Pending
    Running on runner-hj-7hck-project-62103-concurrent-1-ug74h61m via gitlab-prod-runner-gitlab-runner-5d6b64f896-rz4f2...
    Getting source from Git repository
    00:01
    Fetching changes with git depth set to 50...
    Initialized empty Git repository in /builds/project/masquerade_log/.git/
    Created fresh repository.
    Checking out b510089b as detached HEAD (ref is 8.x-1.x)...
    Skipping Git submodules setup
    Downloading artifacts
    00:05
    Downloading artifacts for composer (1751132)...
    Downloading artifacts from coordinator... ok        host=drupal-gitlab-job-artifacts.s3.us-west-2.amazonaws.com id=1751132 responseStatus=200 OK token=glcbt-64
    Executing "step_script" stage of the job script
    00:01
    $ [[ $_CURL_TEMPLATES_REF == "" ]] && export _CURL_TEMPLATES_REF=$_GITLAB_TEMPLATES_REF # collapsed multi-line command
    $ test -f phpcs.xml.dist || curl -OL https://git.drupalcode.org/$_CURL_TEMPLATES_REPO/-/raw/$_CURL_TEMPLATES_REF/assets/phpcs.xml.dist
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100   320  100   320    0     0   2644      0 --:--:-- --:--:-- --:--:--  2644
    $ vendor/bin/phpcs --version
    PHP_CodeSniffer version 3.10.1 (stable) by Squiz and PHPCSStandards
    $ composer show | awk '$0 ~ /codesniffer|coder|coding-standard|variable-analysis/ {print $1 " " $2}';
    dealerdirect/phpcodesniffer-composer-installer 1.0.0
    drupal/coder 8.3.24
    sirbrillig/phpcs-variable-analysis 2.11.18
    slevomat/coding-standard 8.15.0
    squizlabs/php_codesniffer 3.10.1
    $ vendor/bin/phpcs --config-show installed_paths
    Using config file: /builds/project/masquerade_log/vendor/squizlabs/php_codesniffer/CodeSniffer.conf
    installed_paths: ../../drupal/coder/coder_sniffer,../../sirbrillig/phpcs-variable-analysis,../../slevomat/coding-standard
    $ vendor/bin/phpcs -i
    The installed coding standards are MySource, PEAR, PSR1, PSR2, PSR12, Squiz, Zend, Drupal, DrupalPractice, VariableAnalysis and SlevomatCodingStandard
    $ vendor/bin/phpcs -s $_WEB_ROOT/modules/custom --report-junit=junit.xml --report-full --report-summary --report-source $_PHPCS_EXTRA
    FILE: ...b/modules/custom/masquerade_log/tests/src/Functional/MasqueradeLogTest.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     3 | ERROR | [x] Expected strict_types=1, found strict_types = 1.
       |       |     (SlevomatCodingStandard.TypeHints.DeclareStrictTypes.IncorrectStrictTypesFormat)
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    FILE: ...squerade_log/web/modules/custom/masquerade_log/src/MasqueradeLogLogger.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     3 | ERROR | [x] Expected strict_types=1, found strict_types = 1.
       |       |     (SlevomatCodingStandard.TypeHints.DeclareStrictTypes.IncorrectStrictTypesFormat)
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    Time: 129ms; Memory: 6MB
    PHP CODE SNIFFER REPORT SUMMARY
    --------------------------------------------------------------------------------
    FILE                                                            ERRORS  WARNINGS
    --------------------------------------------------------------------------------
    ...b/modules/custom/masquerade_log/src/MasqueradeLogLogger.php  1       0
    ...m/masquerade_log/tests/src/Functional/MasqueradeLogTest.php  1       0
    --------------------------------------------------------------------------------
    A TOTAL OF 2 ERRORS AND 0 WARNINGS WERE FOUND IN 3 FILES
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX 2 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    PHP CODE SNIFFER VIOLATION SOURCE SUMMARY
    --------------------------------------------------------------------------------
        SOURCE                                                                 COUNT
    --------------------------------------------------------------------------------
    [x] SlevomatCodingStandard.TypeHints.DeclareStrictTypes.IncorrectStrictTy  2
    --------------------------------------------------------------------------------
    A TOTAL OF 2 SNIFF VIOLATIONS WERE FOUND IN 1 SOURCE
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SOURCES AUTOMATICALLY (2 VIOLATIONS IN TOTAL)
    --------------------------------------------------------------------------------
    Uploading artifacts for failed job
    00:02
    Uploading artifacts...
    junit.xml: found 1 matching artifact files and directories 
    Uploading artifacts as "archive" to coordinator... 201 Created  id=1751134 responseStatus=201 Created token=glcbt-64
    Uploading artifacts...
    junit.xml: found 1 matching artifact files and directories 
    Uploading artifacts as "junit" to coordinator... 201 Created  id=1751134 responseStatus=201 Created token=glcbt-64
    Cleaning up project directory and file based variables
    00:00
    ERROR: Job failed: command terminated with exit code 1
  • Status changed to Needs review 25 days ago
Production build 0.69.0 2024