Problem/Motivation
There is a files need to fixed with coding standards.
Here is the command : -
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml,twig web/modules/contrib/search_tracking/
Result :-
FILE: /home/chandansha/docker/testd10/web/modules/contrib/search_tracking/search_tracking.views.inc
---------------------------------------------------------------------------------------------------
FOUND 31 ERRORS AFFECTING 30 LINES
---------------------------------------------------------------------------------------------------
4 | ERROR | [x] The second line in the file doc comment must be "@file"
5 | ERROR | [x] There must be no blank lines after the function comment
8 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
9 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
10 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
11 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
12 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
14 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
15 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
16 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
17 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
18 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
19 | ERROR | [x] Array indentation error, expected 10 spaces but found 8
22 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
23 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
24 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
25 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
26 | ERROR | [x] Array indentation error, expected 10 spaces but found 8
29 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
30 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
31 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
32 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
33 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
35 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
36 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
37 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
39 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
40 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
43 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
44 | ERROR | [x] Expected 1 newline at end of file; 2 found
44 | ERROR | [x] Whitespace found at end of line
---------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 31 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------
FILE: /home/chandansha/docker/testd10/web/modules/contrib/search_tracking/README.md
-----------------------------------------------------------------------------------
FOUND 1 ERROR AND 7 WARNINGS AFFECTING 8 LINES
-----------------------------------------------------------------------------------
3 | WARNING | [ ] Line exceeds 80 characters; contains 142 characters
23 | WARNING | [ ] Line exceeds 80 characters; contains 92 characters
29 | WARNING | [ ] Line exceeds 80 characters; contains 88 characters
39 | WARNING | [ ] Line exceeds 80 characters; contains 112 characters
41 | WARNING | [ ] Line exceeds 80 characters; contains 91 characters
42 | WARNING | [ ] Line exceeds 80 characters; contains 113 characters
47 | WARNING | [ ] Line exceeds 80 characters; contains 203 characters
66 | ERROR | [x] Expected 1 newline at end of file; 3 found
-----------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------
FILE: /home/chandansha/docker/testd10/web/modules/contrib/search_tracking/search_tracking.info.yml
-------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------
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
-------------------------------------------------------------------------------------------------------------
FILE: /home/chandansha/docker/testd10/web/modules/contrib/search_tracking/src/Form/SearchTrackingConfig.php
------------------------------------------------------------------------------------------------------------
FOUND 87 ERRORS AND 4 WARNINGS AFFECTING 73 LINES
------------------------------------------------------------------------------------------------------------
3 | ERROR | [x] Namespaced classes, interfaces and traits should not begin with a file doc comment
5 | ERROR | [x] Doc comment short description must end with a full stop
12 | WARNING | [x] Unused use statement
12 | ERROR | [x] There must be one blank line after the last USE statement; 2 found;
16 | ERROR | [x] Function comment short description must start with exactly one space
16 | ERROR | [x] Doc comment short description must end with a full stop
19 | ERROR | [x] Opening brace should be on the same line as the declaration
21 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
21 | ERROR | [x] Missing function doc comment
22 | ERROR | [x] Opening brace should be on the same line as the declaration
23 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
24 | WARNING | [x] A comma should follow the last multiline array item. Found: 'search_tracking.settings'
26 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
28 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
31 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
32 | ERROR | [x] Opening brace should be on the same line as the declaration
33 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
34 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
36 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
39 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
40 | ERROR | [x] Opening brace should be on the same line as the declaration
41 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
43 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
44 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
45 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
46 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
47 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
47 | ERROR | [x] Short array syntax must be used to define arrays
47 | WARNING | [ ] #options values usually have to run through t() for translation
48 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
50 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
51 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
52 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
53 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
54 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
54 | ERROR | [x] Short array syntax must be used to define arrays
55 | ERROR | [x] Array indentation error, expected 14 spaces but found 16
55 | ERROR | [x] Short array syntax must be used to define arrays
55 | ERROR | [x] Short array syntax must be used to define arrays
57 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
59 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
60 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
61 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
62 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
63 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
63 | ERROR | [x] Short array syntax must be used to define arrays
64 | ERROR | [x] Array indentation error, expected 14 spaces but found 16
64 | ERROR | [x] Short array syntax must be used to define arrays
64 | ERROR | [x] Short array syntax must be used to define arrays
66 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
68 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
69 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
70 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
71 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
72 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
72 | ERROR | [x] Short array syntax must be used to define arrays
73 | ERROR | [x] Array indentation error, expected 14 spaces but found 16
73 | ERROR | [x] Short array syntax must be used to define arrays
73 | ERROR | [x] Short array syntax must be used to define arrays
75 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
77 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
78 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
79 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
80 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
81 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
82 | ERROR | [x] Array indentation error, expected 14 spaces but found 16
83 | ERROR | [x] Array indentation error, expected 18 spaces but found 20
89 | ERROR | [x] Array indentation error, expected 10 spaces but found 12
92 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
93 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
95 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
98 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
98 | WARNING | [ ] Possible useless method overriding detected
99 | ERROR | [x] Opening brace should be on the same line as the declaration
100 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
101 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
101 | ERROR | [x] Expected 1 blank line after function; 0 found
102 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
105 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
106 | ERROR | [x] Opening brace should be on the same line as the declaration
107 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
108 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
108 | ERROR | [x] Expected 1 blank line after function; 0 found
109 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
112 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
113 | ERROR | [x] Opening brace should be on the same line as the declaration
114 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
115 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
116 | ERROR | [x] Object operator not indented correctly; expected 10 spaces but found 12
122 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
122 | ERROR | [x] Expected 1 blank line after function; 0 found
------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 89 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------
FILE: /home/chandansha/docker/testd10/web/modules/contrib/search_tracking/src/Controller/searchTrackingController.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 12 ERRORS AND 8 WARNINGS AFFECTING 16 LINES
------------------------------------------------------------------------------------------------------------------------------------------
6 | WARNING | [x] Unused use statement
7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Symfony\Component\HttpFoundation\JsonResponse.
8 | WARNING | [x] Unused use statement
8 | ERROR | [x] When importing a class with "use", do not include a leading \
9 | WARNING | [x] Unused use statement
14 | ERROR | [ ] Class name must begin with a capital letter
16 | ERROR | [x] Missing function doc comment
18 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
19 | ERROR | [x] Expected 1 space after IF keyword; 0 found
19 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
20 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
24 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
24 | ERROR | [x] Whitespace found at end of line
25 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
33 | ERROR | [x] Missing function doc comment
33 | ERROR | [ ] Public method name "searchTrackingController::search_tracking" is not in lowerCamel format
34 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
37 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
42 | ERROR | [x] Expected 1 blank line after function; 0 found
43 | ERROR | [x] The closing brace for the class must have an empty line before it
------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 13 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------
FILE: /home/chandansha/docker/testd10/web/modules/contrib/search_tracking/templates/page--admin--config--search--search-tracking.html.twig
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------
64 | ERROR | [x] Expected 1 newline at end of file; 0 found
------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------
FILE: /home/chandansha/docker/testd10/web/modules/contrib/search_tracking/search_tracking.install
-------------------------------------------------------------------------------------------------
FOUND 18 ERRORS AND 1 WARNING AFFECTING 16 LINES
-------------------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
2 | ERROR | [x] Missing function doc comment
2 | ERROR | [x] Expected 1 blank line before function; 0 found
3 | ERROR | [x] Short array syntax must be used to define arrays
5 | ERROR | [x] Short array syntax must be used to define arrays
6 | ERROR | [x] Short array syntax must be used to define arrays
7 | ERROR | [x] Array indentation error, expected 8 spaces but found 6
8 | ERROR | [x] Array indentation error, expected 8 spaces but found 6
9 | ERROR | [x] Array indentation error, expected 8 spaces but found 6
10 | ERROR | [x] Array indentation error, expected 8 spaces but found 6
12 | ERROR | [x] Short array syntax must be used to define arrays
18 | ERROR | [x] Short array syntax must be used to define arrays
24 | ERROR | [x] Short array syntax must be used to define arrays
29 | WARNING | [x] A comma should follow the last multiline array item. Found: )
30 | ERROR | [x] Whitespace found at end of line
31 | ERROR | [x] Short array syntax must be used to define arrays
31 | ERROR | [x] Whitespace found at end of line
32 | ERROR | [x] Whitespace found at end of line
-------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 19 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------
FILE: /home/chandansha/docker/testd10/web/modules/contrib/search_tracking/search_tracking.module
--------------------------------------------------------------------------------------------------------------------------------
FOUND 20 ERRORS AND 5 WARNINGS AFFECTING 19 LINES
--------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
3 | WARNING | [x] Unused use statement
3 | ERROR | [x] When importing a class with "use", do not include a leading \
4 | WARNING | [x] Unused use statement
5 | WARNING | [x] Unused use statement
5 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Form\FormStateInterface.
6 | WARNING | [x] Unused use statement
6 | ERROR | [x] There must be one blank line after the last USE statement; 0 found;
6 | ERROR | [x] When importing a class with "use", do not include a leading \
10 | ERROR | [x] Expected 1 blank line before function; 0 found
13 | ERROR | [x] Expected 1 blank line after function; 0 found
18 | ERROR | [x] Inline comments must start with a capital letter
18 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
21 | ERROR | [x] Inline comments must start with a capital letter
21 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
25 | ERROR | [x] Expected 1 space after IF keyword; 0 found
26 | ERROR | [x] Expected 1 space after IF keyword; 0 found
31 | ERROR | [x] Expected 1 space after ELSEIF keyword; 0 found
32 | ERROR | [x] Expected 1 space after IF keyword; 0 found
37 | ERROR | [x] Expected 1 space after ELSEIF keyword; 0 found
38 | ERROR | [x] Expected 1 space after IF keyword; 0 found
42 | ERROR | [x] Expected 1 blank line after function; 0 found
45 | ERROR | [x] Expected 1 space(s) before asterisk; 0 found
50 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
52 | ERROR | [x] Expected 1 newline at end of file; 0 found
--------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 25 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------
Time: 96ms; Memory: 10MB
Steps to reproduce
Run PHPCS on search_tracking module.
Proposed resolution
Fixed the coding standards.
Remaining tasks
Submit the patch either MR .