Fix the issues reported by phpcs

Created on 8 December 2016, almost 8 years ago
Updated 7 June 2024, 6 months ago

Problem/Motivation

โฏ phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml,css,js .

Steps to reproduce

Run following command
phpcs --standard=โ€œDrupal,DrupalPracticeโ€ --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml,css,js .

Added .gitlab-ci.yml

include:
  - project: $_GITLAB_TEMPLATES_REPO
    ref: $_GITLAB_TEMPLATES_REF
    file:
      - '/includes/include.drupalci.main.yml'
      - '/includes/include.drupalci.variables.yml'
      - '/includes/include.drupalci.workflows.yml'

variables:
  SKIP_ESLINT: '1'

phpcs:
  allow_failure: false

phpstan:
  stage: validate
  rules:
    - if: '$SKIP_PHPSTAN == "1"'
      when: never
    - when: on_success
  artifacts:
    when: always
    reports:
      codequality: phpstan-report.json
  script:
    - vendor/bin/phpstan analyze --memory-limit=2G --no-interaction --no-progress --error-format=gitlab $_WEB_ROOT/modules/custom | tee phpstan-report.json

๐Ÿ“Œ Task
Status

Fixed

Version

2.0

Component

Code

Created by

๐Ÿ‡ง๐Ÿ‡ทBrazil renatog Campinas

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

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    The issue summary should always describe what the issue is trying to fix and, in the case, of coding standards issues, show which command has been used, which arguments have been used, and which report that command shown.

    Also, the report should not be a screenshot.

  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia VladimirAus Brisbane, Australia

    Latest patch doesn't apply to dev branch.
    Needs work.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia imustakim Ahmedabad

    Issue summary updated.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • ๐Ÿ‡ช๐Ÿ‡ธSpain aleix

    I am planning to contribute on this, but i am focussing on drupal 10, is it possible to create a dev branch to be able to apply coding standards there?

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States Todd Zebert Los Angeles, CA

    I didn't see this fix in the last patch, but the error is in the phpcs output in the original post. The same error arrises from what's we're running (to confirm PHP8.1 compatibility) phpcs --runtime-set testVersion 8.1- --standard=PHPCompatibility.

    -----------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------------------------------
    88 | ERROR | The behaviour of hexadecimal numeric strings was inconsistent prior to PHP 7 and support has been removed in PHP 7. Found: '0x0'
    -----------------------------------------------------------------------------------------------------------------------------------------------

  • bindu r โ†’ made their first commit to this issueโ€™s fork.

  • Status changed to Needs review 12 months ago
  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia VladimirAus Brisbane, Australia
  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia VladimirAus Brisbane, Australia

    Switching to 2.0.x branch as 8.x is deprecated.

  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia VladimirAus Brisbane, Australia

    VladimirAus โ†’ changed the visibility of the branch 2.0.x to hidden.

  • Merge request !10Resolve #2833962 "Fix the issues d10" โ†’ (Merged) created by VladimirAus
  • Status changed to Needs work 11 months ago
  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia jannakha Brisbane!

    fix unit tests errors

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States apotek

    There are two issues in this issue: coding standards and adding gitlab.ci. Most of the friction here is coming from the coding standards. Should we create a separate issue just for the gitlab work (which is complete) and at least be able to get that ported into any active branches? That will _really_ help any new merge requests in gitlab while the code style issues get hashed out. I understand that this will lead to failing tests until the phpcs issues are fixed, but we can set those failing tests to ignore in the meantime. Happy to lead on this if desired.

  • ๐Ÿ‡ท๐Ÿ‡บRussia zniki.ru

    Should we create a separate issue just for the gitlab work (which is complete) and at least be able to get that ported into any active branches?

    Yes, this is good idea to create separate issue.
    And separate issue to fix phpunit tests can be created as well.

    I hide patch files, because MR workflow is used.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States apotek
    Should we create a separate issue just for the gitlab work (which is complete) and at least be able to get that ported into any active branches?

    Yes, this is good idea to create separate issue.
    And separate issue to fix phpunit tests can be created as well.

    @nikolay-shapovalov I have created a separate issue ๐Ÿ“Œ Add gitlab.ci Needs work just for the gitlab-ci.yml starter file, so we can get that in and start getting feedback on merge requests, even if tests are allowed to fail.

    https://www.drupal.org/project/dfp/issues/3416546 ๐Ÿ“Œ Add gitlab.ci Needs work

    And as you said, moving the test fixes into a separate issue would also be good to do... Thank you.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States apotek

    Updated title to reflect focus on this issue being the coding standards and letting the initial addition of gitlab-ci work be addressed separately https://www.drupal.org/project/dfp/issues/3416546 ๐Ÿ“Œ Add gitlab.ci Needs work

  • First commit to issue fork.
  • Pipeline finished with Failed
    8 months ago
    Total: 209s
    #119637
  • Status changed to Needs review 8 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Shank115

    I

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Yashaswi18

    Hello, checked out to the branch '2833962-fix-the-issues-d10' and ran the command phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml,css,js, found no errors or warnings remaining.

  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia VladimirAus Brisbane, Australia

    VladimirAus โ†’ changed the visibility of the branch 2833962-fix-the-issues to hidden.

  • Status changed to RTBC 6 months ago
  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia jannakha Brisbane!

    outstanding failed CI items are created as separate tasks

  • Pipeline finished with Skipped
    6 months ago
    #181191
  • Status changed to Fixed 6 months ago
  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia VladimirAus Brisbane, Australia

    Thank you! Committed! ๐Ÿฅ‚

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024