phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig shows the following errors/warnings that should be fixed.

FILE: ./www_authenticate/www_authenticate.services.yml
----------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------
 5 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------


FILE: ./www_authenticate/www_authenticate.info.yml
------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 3 WARNINGS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------
  1 | WARNING | [ ] Remove "project" from the info file, it will be added by drupal.org packaging automatically
  1 | WARNING | [ ] Remove "datestamp" from the info file, it will be added by drupal.org packaging automatically
  1 | WARNING | [ ] Remove "version" from the info file, it will be added by drupal.org packaging automatically
 13 | ERROR   | [x] Expected 1 newline at end of file; 0 found
------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------


FILE: ./www_authenticate/www_authenticate.permissions.yml
-------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------
 3 | ERROR | [x] Expected 1 newline at end of file; 0 found
-------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------


FILE: ./www_authenticate/config/install/www_authenticate.config.yml
-----------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------
 4 | ERROR | [x] Expected 1 newline at end of file; 0 found
-----------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------


FILE: ./www_authenticate/src/WwwAuthenticateSubscriber.php
------------------------------------------------------------------------------------------------------------------------------
FOUND 26 ERRORS AND 5 WARNINGS AFFECTING 23 LINES
------------------------------------------------------------------------------------------------------------------------------
  1 | ERROR   | [x] The PHP open tag must be followed by exactly one blank line
  2 | ERROR   | [x] Namespaced classes, interfaces and traits should not begin with a file doc comment
 10 | WARNING | [x] Unused use statement
 18 | ERROR   | [ ] Doc comment short description must start with a capital letter
 19 | ERROR   | [x] There must be exactly one blank line before the tags in a doc comment
 19 | ERROR   | [ ] The @see reference should not contain any additional text
 21 | ERROR   | [ ] Parameter tags must be defined first in a doc comment
 24 | ERROR   | [ ] Public method name "WwwAuthenticateSubscriber::WwwAuthenticateLoad" is not in lowerCamel format
 24 | ERROR   | [x] Expected 1 blank line before function; 0 found
 27 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 41 | ERROR   | [x] Expected 1 space before "==="; 3 found
 45 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 2
 45 | ERROR   | [x] Closing brace indented incorrectly; expected 4 spaces, found 2
 45 | ERROR   | [x] Expected newline after closing brace
 47 | WARNING | [ ] Line exceeds 80 characters; contains 84 characters
 48 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 4
 49 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 4
 49 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 51 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 4
 52 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 4
 54 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 4
 56 | WARNING | [ ] Code after the EXIT statement on line 54 cannot be executed
 56 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 4
 57 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 2
 58 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 0
 58 | ERROR   | [x] Closing brace indented incorrectly; expected 2 spaces, found 0
 63 | ERROR   | [x] Visibility must be declared on method "getSubscribedEvents"
 65 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 66 | ERROR   | [x] Short array syntax must be used to define arrays
 69 | ERROR   | [x] Expected 1 newline at end of file; 0 found
 69 | ERROR   | [x] The closing brace for the class must have an empty line before it
------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 23 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------


FILE: ./www_authenticate/src/Form/WwwAuthenticateForm.php
--------------------------------------------------------------------------------------------------------
FOUND 11 ERRORS AND 1 WARNING AFFECTING 12 LINES
--------------------------------------------------------------------------------------------------------
   3 | ERROR   | [x] Namespaced classes, interfaces and traits should not begin with a file doc comment
  12 | WARNING | [x] Unused use statement
  39 | ERROR   | [x] Short array syntax must be used to define arrays
  44 | ERROR   | [x] Short array syntax must be used to define arrays
  50 | ERROR   | [x] Short array syntax must be used to define arrays
  56 | ERROR   | [x] Short array syntax must be used to define arrays
  62 | ERROR   | [x] Short array syntax must be used to define arrays
  68 | ERROR   | [x] Short array syntax must be used to define arrays
  89 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
  90 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
  91 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 100 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
--------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 12 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------

Time: 46ms; Memory: 10MB
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

    jayprakash.kushwah created an issue. See original summary.

    jayprakash.kushwah’s picture

    jayprakash.kushwah’s picture

    avpaderno’s picture

    Title: Issues for Coding Standards » Fix the issues reported by phpcs
    Category: Support request » Task
    Priority: Major » Normal
    Status: Active » Needs work
    Issue tags: +Coding standards, +Needs issue summary update

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

    nitin_lama’s picture

    Assigned: Unassigned » nitin_lama
    nitin_lama’s picture

    Issue summary: View changes
    StatusFileSize
    new55.77 KB
    new5.76 KB

    The provided patch doesn't apply. Providing an updated patch.

    phpcs_errors

    nitin_lama’s picture

    Assigned: nitin_lama » Unassigned
    nitin_lama’s picture

    avpaderno’s picture

    Issue summary: View changes
    avpaderno’s picture

    Version: 1.0.2 » 1.0.1

    When I run the reported command, I get more errors/warnings.

    avpaderno’s picture

    Issue summary: View changes
    Issue tags: +Needs reroll
    mrinalini9’s picture

    Status: Needs work » Needs review
    Issue tags: -Needs reroll
    StatusFileSize
    new7.97 KB

    Rerolled patch #6, please review it.

    Thanks!

    avpaderno’s picture

    Status: Needs review » Needs work
    -      // Authentication failed, print the authorization headers and end the request.
    -    $print = $config->get('message');
    -    $sitename = \Drupal::config('system.site')->get('name');
    +      // Authentication failed, print the authorization headers and end the
    +      // request.
    +      $print = $config->get('message');
    +      $sitename = \Drupal::config('system.site')->get('name');
    

    The sentence in the comment is an example of comma-splice sentence, which is grammatically not correct. Instead of the comma, the correct punctuation mark is either the semicolon or the period.

    -   * // only if KernelEvents::REQUEST !!!
    -   * @see Symfony\Component\HttpKernel\KernelEvents for details
    +   * Only if KernelEvents::REQUEST !!!
    +   *
    +   * @see Symfony\Component\HttpKernel\KernelEvents
        *
        * @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event
        *   The Event to process.

    Only if KernelEvents::REQUEST !!! is not necessary, since that is clear from the used code.
    The @see line must be after the @param line. The correct order is the following one.

    • @var
    • @param
    • @return
    • @throws
    • @ingroup
    • @deprecated
    • @see
    • @todo
    -    // Add WwwAuthenticateLoad as a subscriber to the request event.
    -    // $events[KernelEvents::REQUEST][] = array('WwwAuthenticateLoad', 20);
    -    $events[KernelEvents::REQUEST][] = array('WwwAuthenticateLoad');
    +  public static function getSubscribedEvents() {
    +    // Add wwwAuthenticateLoad as a subscriber to the request event.
    +    // $events[KernelEvents::REQUEST][] = array('wwwAuthenticateLoad', 20);.

    Periods are not added at the end of commented out code. That commented out line is not even necessary, like the comment before it.

    imustakim’s picture

    Assigned: Unassigned » imustakim
    imustakim’s picture

    Assigned: imustakim » Unassigned
    Status: Needs work » Needs review
    StatusFileSize
    new8.43 KB

    Patch updated.
    Please review.

    sujan shrestha’s picture

    Version: 1.0.1 » 1.0.4
    Status: Needs review » Fixed
    sujan shrestha’s picture

    Status: Fixed » Closed (fixed)