Fix the issues reported by phpcs

Created on 30 June 2022, almost 2 years ago
Updated 2 June 2024, 21 days ago

Problem/Motivation

phpcs --standard=Drupal reports the following issues.

FILE: C:\xampp\htdocs\test\web\modules\contrib\interface_views_sort\interface_views_sort.module
-----------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
5 | ERROR | [x] Expected 1 blank line before function; 0 found
-----------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\test\web\modules\contrib\interface_views_sort\src\Plugin\views\sort\LanguageSwitcherSort.php
------------------------------------------------------------------------------------------------------------------
FOUND 75 ERRORS AND 2 WARNINGS AFFECTING 69 LINES
------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
11 | ERROR | [x] Expected 1 space(s) before asterisk; 0 found
12 | ERROR | [x] Expected 1 space(s) before asterisk; 0 found
13 | ERROR | [x] Expected 1 space(s) before asterisk; 0 found
14 | ERROR | [x] Expected 1 space(s) before asterisk; 0 found
15 | ERROR | [x] Expected 1 space(s) before asterisk; 0 found
16 | ERROR | [x] Expected 1 space(s) before asterisk; 0 found
17 | ERROR | [x] Expected 1 space(s) before asterisk; 0 found
17 | ERROR | [x] There must be exactly one newline after the class comment
21 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
21 | WARNING | [ ] Possible useless method overriding detected
21 | ERROR | [x] Missing function doc comment
22 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
23 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
25 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
26 | ERROR | [x] Expected 5 space(s) before asterisk; 4 found
26 | ERROR | [x] Doc comment short description must end with a full stop
27 | ERROR | [x] Expected 5 space(s) before asterisk; 4 found
28 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
28 | WARNING | [ ] Possible useless method overriding detected
29 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
30 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
32 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
32 | ERROR | [x] Missing function doc comment
34 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
34 | ERROR | [x] Missing function doc comment
36 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
37 | ERROR | [x] Expected 5 space(s) before asterisk; 4 found
38 | ERROR | [x] Expected 5 space(s) before asterisk; 4 found
39 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
40 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
41 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
42 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
43 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
45 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
46 | ERROR | [x] Expected 5 space(s) before asterisk; 4 found
47 | ERROR | [x] Expected 5 space(s) before asterisk; 4 found
48 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
49 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
50 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
52 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
54 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
55 | ERROR | [x] Expected 5 space(s) before asterisk; 4 found
56 | ERROR | [x] Expected 5 space(s) before asterisk; 4 found
57 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
58 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
59 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
60 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
61 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
63 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
64 | ERROR | [x] Expected 5 space(s) before asterisk; 4 found
65 | ERROR | [x] Expected 5 space(s) before asterisk; 4 found
66 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
67 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
68 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
69 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
70 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 12
71 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
72 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
73 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
75 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
76 | ERROR | [x] Expected 5 space(s) before asterisk; 4 found
77 | ERROR | [x] Expected 5 space(s) before asterisk; 4 found
78 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
79 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
80 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
82 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
83 | ERROR | [x] Expected 5 space(s) before asterisk; 4 found
84 | ERROR | [x] Expected 5 space(s) before asterisk; 4 found
85 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
86 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
87 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
88 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
89 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
90 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
92 | ERROR | [x] Expected 1 newline at end of file; 0 found
------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 75 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------

Time: 360ms; Memory: 8MB

๐Ÿ“Œ Task
Status

Needs review

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia Ashutosh Ahirwal India

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, ๐Ÿ‡ฎ๐Ÿ‡น
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
    +/**
    + * @file
    + * Implements Module file for hooks.
    + */

    The short description for a module is Hook implementations for the [module name] module.

    -    protected function defineOptions() {
    -        return parent::defineOptions();
    -    }
    +  /**
    +   * Simple validate handler.
    +   */
    +  protected function sortValidate(&$form, FormStateInterface $form_state) {}

    It is not necessary to add an empty method when the same method is implemented by a parent class.

    +  /**
    +   * Provide default options for exposed sorts.
    +   */
    +  public function defaultExposeOptions() {
    +    $this->options['expose'] = [
    +      'label' => $this->definition['title'],
    +    ];
    +  }

    The return value is not described.

  • Assigned to imustakim
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia imustakim Ahmedabad
  • Issue was unassigned.
  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia imustakim Ahmedabad

    The return value is not described because the function has no return statement. Rest of the suggestions mentioned in #10 ๐Ÿ“Œ Fix the issues reported by phpcs Needs review updated in the following patch.

    Please review.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Yashaswi18

    The patch provided in #12 applies cleanly, one error remaining :

    FILE: /home/yashaswi/contribs/interface_views_sort/src/Plugin/views/sort/LanguageSwitcherSort.php
    ------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------
     8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is
       |       |     Drupal\Core\Language\LanguageInterface.
    ------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------
  • Pipeline finished with Success
    3 months ago
    Total: 138s
    #119238
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Preethy_ray

    pray_12 โ†’ made their first commit to this issueโ€™s fork.

  • Pipeline finished with Success
    3 months ago
    Total: 138s
    #121975
  • Status changed to RTBC 3 months ago
  • Status changed to Needs work about 2 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • Pipeline finished with Success
    about 2 months ago
    Total: 222s
    #161391
  • Shruu_rao โ†’ made their first commit to this issueโ€™s fork.

  • Pipeline finished with Success
    about 2 months ago
    Total: 140s
    #165585
  • Status changed to Needs review about 2 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia dev16.addweb

    I've tested the MR and all PHPCS issues are resolved.

  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines clarkssquared

    Hi

    I applied the updated MR !1 and I confirmed that it has no PHPCS issues,

    โžœ  interface_views_sort git:(1.0.x) curl https://git.drupalcode.org/project/interface_views_sort/-/merge_requests/1.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 11098    0 11098    0     0  20516      0 --:--:-- --:--:-- --:--:-- 20705
    patching file .gitlab-ci.yml
    patching file interface_views_sort.module
    patching file 'src/Plugin/views/sort/LanguageSwitcherSort.php'
    โžœ  contrib git:(master) โœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml interface_views_sort 
    โžœ  contrib git:(master) โœ— 
    
    

    RTBC +1 from me, retaining the status to needs review for others to contribute

Production build 0.69.0 2024