Fix the issues reported by phpcs

Created on 5 April 2023, over 2 years ago

Problem/Motivation

Getting these phpcs errors and warnings.

FILE: tests/modules/cloudflare_form_tester/src/Mocks/ComposerDependenciesCheckMock.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 51 | WARNING | \Drupal calls should be avoided in classes, use dependency
    |         | injection instead
--------------------------------------------------------------------------------


FILE: tests/modules/cloudflare_form_tester/src/Mocks/ZoneMock.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 135 | WARNING | \Drupal calls should be avoided in classes, use dependency
     |         | injection instead
--------------------------------------------------------------------------------


FILE: /tests/src/Unit/ClientIpRestoreTest.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------
  13 | WARNING | [x] Unused use statement
  92 | WARNING | [x] A comma should follow the last multiline array item.
     |         |     Found: $bypass_host
 101 | WARNING | [x] A comma should follow the last multiline array item.
     |         |     Found: ]
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: /tests/src/Functional/CloudFlareAdminSettingsFormTest.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 16 | ERROR | [x] Missing class doc comment
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: /tests/src/Functional/ComposerDependencyTest.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 15 | ERROR | [x] Missing class doc comment
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: /tests/src/Functional/CloudFlareAdminSettingsInvalidFormTest.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
--------------------------------------------------------------------------------
 18 | ERROR   | [x] Missing class doc comment
 85 | WARNING | [ ] Unused variable $mock.
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: /tests/src/Functional/VariousUseCasesTest.php
--------------------------------------------------------------------------------
FOUND 7 ERRORS AND 2 WARNINGS AFFECTING 9 LINES
--------------------------------------------------------------------------------
  12 | WARNING | [ ] Line exceeds 80 characters; contains 88 characters
  17 | ERROR   | [x] Missing class doc comment
  40 | ERROR   | [x] Expected 1 blank line before function; 2 found
  59 | ERROR   | [ ] Doc comment short description must be on a single line,
     |         |     further text should be a separate paragraph
  91 | WARNING | [x] A comma should follow the last multiline array item.
     |         |     Found: ]
 114 | ERROR   | [x] Expected 1 blank line after function; 2 found
 126 | ERROR   | [x] Expected 1 blank line after function; 2 found
 132 | ERROR   | [ ] Missing parameter type
 145 | ERROR   | [ ] Missing parameter type
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: /docs/enterprise_setup.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
----------------------------------------------------------------------
  4 | WARNING | Line exceeds 80 characters; contains 128 characters
  5 | WARNING | Line exceeds 80 characters; contains 197 characters
 14 | WARNING | Line exceeds 80 characters; contains 85 characters
 15 | WARNING | Line exceeds 80 characters; contains 197 characters
 16 | WARNING | Line exceeds 80 characters; contains 213 characters
----------------------------------------------------------------------


FILE: /docs/freetier_setup.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
----------------------------------------------------------------------
  4 | WARNING | Line exceeds 80 characters; contains 128 characters
  5 | WARNING | Line exceeds 80 characters; contains 197 characters
 15 | WARNING | Line exceeds 80 characters; contains 85 characters
 16 | WARNING | Line exceeds 80 characters; contains 197 characters
 17 | WARNING | Line exceeds 80 characters; contains 213 characters
----------------------------------------------------------------------


FILE: /docs/disclaimers.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
----------------------------------------------------------------------
  2 | WARNING | Line exceeds 80 characters; contains 187 characters
  7 | WARNING | Line exceeds 80 characters; contains 312 characters
 15 | WARNING | Line exceeds 80 characters; contains 103 characters
----------------------------------------------------------------------


FILE: README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 9 WARNINGS AFFECTING 9 LINES
----------------------------------------------------------------------
  2 | WARNING | Line exceeds 80 characters; contains 124 characters
  6 | WARNING | Line exceeds 80 characters; contains 115 characters
  9 | WARNING | Line exceeds 80 characters; contains 86 characters
 30 | WARNING | Line exceeds 80 characters; contains 117 characters
 31 | WARNING | Line exceeds 80 characters; contains 119 characters
 32 | WARNING | Line exceeds 80 characters; contains 118 characters
 36 | WARNING | Line exceeds 80 characters; contains 117 characters
 38 | WARNING | Line exceeds 80 characters; contains 118 characters
 47 | WARNING | Line exceeds 80 characters; contains 86 characters
----------------------------------------------------------------------

FILE: cloudflare.install
------------------------------------------------------------------------------
FOUND 3 ERRORS AND 2 WARNINGS AFFECTING 5 LINES
------------------------------------------------------------------------------
 51 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
 54 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
 63 | ERROR   | [x] Expected 1 space after CATCH keyword; 0 found
 66 | ERROR   | [x] Expected 1 space after CATCH keyword; 0 found
 69 | ERROR   | [x] Expected 1 space after CATCH keyword; 0 found
------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------


FILE: /src/Form/SettingsForm.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------
  25 | WARNING | The class short comment should describe what the class does
     |         | and not simply repeat the class name
 367 | WARNING | Only string literals should be passed to t() where possible
--------------------------------------------------------------------------------


FILE: /src/Form/ZoneSelectionForm.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 20 | WARNING | The class short comment should describe what the class does and
    |         | not simply repeat the class name
--------------------------------------------------------------------------------

Steps to reproduce

run this command in the cloudflare module directory phpcs --standard="Drupal,DrupalPractice" --extensions="php,module,inc,install,test,profile,theme,css,info,txt,md,yml"

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ“Œ Task
Status

Needs work

Version

2.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia TanujJain-TJ

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @TanujJain-TJ
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia TanujJain-TJ

    Adding a patch to resolve all phpcs errors.

    ignored these 2 errors as it contains installation commands

    FILE: /docs/enterprise_setup.md
    ----------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------
     4 | WARNING | Line exceeds 80 characters; contains 128 characters
    ----------------------------------------------------------------------
    
    
    FILE: /docs/freetier_setup.md
    ----------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------
     4 | WARNING | Line exceeds 80 characters; contains 128 characters
    ----------------------------------------------------------------------
  • Status changed to Needs review over 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • Status changed to RTBC over 2 years ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines kenyoOwen

    Hi tanuj

    I applied patch #2 to the โ€œCloudFlareโ€ module against Version 2.0.x-dev and confirmed that the errors and warnings are resolved and the remaining issue is ignored since it is an installation command. Please see the screenshots attached.

    For your review.
    Thank you.

  • Status changed to Needs work over 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
     /**
    - * Class SettingsForm.
    + * Creates Settings Form.

    I am not sure Creates is the right verb.
    Settings and Form are misspelled, since they are not the first word in the phrase.

    +  /**
    +   * The state store.
    +   *
    +   * @var Drupal\Core\State\StateInterface
    +   */
    +  protected $state;
    +   * @param Drupal\Core\State\StateInterface $state
    +   *   The object State.

    That service is usually described as The state key/value store.

  • Assigned to imustakim
  • ๐Ÿ‡จ๐Ÿ‡ฆCanada imustakim Canada

    Working on this.

  • Issue was unassigned.
  • Status changed to Needs review about 2 years ago
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 5.7
    last update about 2 years ago
    Unable to generate test groups
  • ๐Ÿ‡จ๐Ÿ‡ฆCanada imustakim Canada

    Patch updated.
    Please review.

  • Hi, Reviewed the patch at #8, applies cleanly and addresses the comment #6, but found few warnings. Attaching the ss for reference.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia dev16.addweb

    Re-roll the patch #8 according to the latest code changes.

  • Pipeline finished with Canceled
    about 1 year ago
    Total: 46s
    #193471
  • Pipeline finished with Failed
    about 1 year ago
    Total: 149s
    #193474
  • Pipeline finished with Canceled
    about 1 year ago
    Total: 42s
    #193521
  • Pipeline finished with Failed
    about 1 year ago
    Total: 163s
    #193524
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • Pipeline finished with Running
    about 1 year ago
    #193538
  • ๐Ÿ‡ต๐Ÿ‡นPortugal jcnventura

    jcnventura โ†’ changed the visibility of the branch 3352408-fix-the-issues to hidden.

  • Pipeline finished with Failed
    about 1 year ago
    Total: 185s
    #206871
  • First commit to issue fork.
  • Pipeline finished with Skipped
    3 days ago
    #561054
  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand RoSk0 Wellington

    Thanks

Production build 0.71.5 2024