The module currently has a slew of Coding Standards issues. These are all minor and don't break features, but it is best practice to adhere to Drupal Coding Standards (http://drupal.org/coding-standards) Here are the errors reported by automated review tool PAReview:
http://ventral.org/pareview/httpgitdrupalorgprojecttaxonomysubtermsgit-7...
I've attached a patch that fixes most of these issues. A few may have slipped through since there are alot there, so my apologies if I missed any. Doesn't change functionality of the module at all, just minor structuring and Coding Standards adherence.
https://www.drupal.org/files/issues/2023-03-02/1821914-2.patch →
Command ran: phpcs --standard=Drupal,DrupalPractice –extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml taxonomy_subterms
Report:
FILE: ...dministrator/Projects/contribution/taxonomy_subterms/taxonomy_subterms.css
--------------------------------------------------------------------------------
FOUND 8 ERRORS AFFECTING 5 LINES
--------------------------------------------------------------------------------
1 | ERROR | [x] Additional whitespace found at start of file
3 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
3 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
3 | ERROR | [x] CSS colours must be defined in lowercase; expected #bbbbbb but
| | found #BBBBBB
4 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
4 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
5 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
6 | ERROR | [x] Expected 1 newline at end of file; 0 found
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...nistrator/Projects/contribution/taxonomy_subterms/taxonomy_subterms.module
--------------------------------------------------------------------------------
FOUND 51 ERRORS AND 9 WARNINGS AFFECTING 48 LINES
--------------------------------------------------------------------------------
10 | ERROR | [ ] Doc comment short description must be on a single line,
| | further text should be a separate paragraph
11 | ERROR | [x] There must be exactly one blank line before the tags in a
| | doc comment
16 | ERROR | [ ] Doc comment short description must be on a single line,
| | further text should be a separate paragraph
17 | ERROR | [x] There must be exactly one blank line before the tags in a
| | doc comment
22 | ERROR | [ ] Doc comment short description must be on a single line,
| | further text should be a separate paragraph
23 | ERROR | [x] There must be exactly one blank line before the tags in a
| | doc comment
28 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements
| | hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements
| | hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "*
| | Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or
| | "* Implements hook_foo_BAR_ID_bar() for block templates."
33 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
37 | ERROR | [x] Use null coalesce operator instead of ternary operator.
49 | ERROR | [x] Whitespace found at end of line
54 | ERROR | [x] Expected 1 space before "="; 0 found
54 | ERROR | [x] Expected 1 space after "="; 0 found
63 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements
| | hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements
| | hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "*
| | Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or
| | "* Implements hook_foo_BAR_ID_bar() for block templates."
67 | ERROR | [x] Expected 1 space before "="; 0 found
67 | ERROR | [x] Expected 1 space after "="; 0 found
83 | WARNING | [x] A comma should follow the last multiline array item.
| | Found: )
84 | ERROR | [x] Expected 1 space before "+"; 0 found
84 | ERROR | [x] Expected 1 space after "+"; 0 found
88 | ERROR | [x] Whitespace found at end of line
93 | ERROR | [x] Array indentation error, expected 8 spaces but found 10
94 | ERROR | [x] Array indentation error, expected 8 spaces but found 10
95 | ERROR | [x] Array closing indentation error, expected 6 spaces but
| | found 8
99 | ERROR | [x] Whitespace found at end of line
100 | ERROR | [x] Inline comments must start with a capital letter
100 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
104 | ERROR | [x] Inline comments must start with a capital letter
104 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
108 | ERROR | [x] Expected 1 space before "="; 0 found
108 | ERROR | [x] Expected 1 space after "="; 0 found
108 | ERROR | [x] Expected 1 space(s) after cast statement; 0 found
109 | ERROR | [x] Whitespace found at end of line
125 | WARNING | [x] A comma should follow the last multiline array item.
| | Found: )
126 | ERROR | [x] Expected 1 space before "+"; 0 found
126 | ERROR | [x] Expected 1 space after "+"; 0 found
135 | ERROR | [x] Array indentation error, expected 8 spaces but found 10
136 | ERROR | [x] Array indentation error, expected 8 spaces but found 10
137 | ERROR | [x] Array indentation error, expected 8 spaces but found 10
138 | ERROR | [x] Array closing indentation error, expected 6 spaces but
| | found 10
142 | ERROR | [x] Whitespace found at end of line
143 | ERROR | [x] Inline comments must start with a capital letter
143 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
147 | ERROR | [x] Inline comments must start with a capital letter
147 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
154 | ERROR | [x] Whitespace found at end of line
159 | ERROR | [x] Expected 1 space before "="; 0 found
159 | ERROR | [x] Expected 1 space after "="; 0 found
165 | ERROR | [x] Expected 1 blank line after function; 2 found
169 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements
| | hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements
| | hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "*
| | Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or
| | "* Implements hook_foo_BAR_ID_bar() for block templates."
180 | ERROR | [x] Array closing indentation error, expected 2 spaces but
| | found 4
183 | ERROR | [x] Expected 1 blank line after function; 2 found
187 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements
| | hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements
| | hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "*
| | Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or
| | "* Implements hook_foo_BAR_ID_bar() for block templates."
191 | ERROR | [x] Expected 1 blank line after function; 2 found
195 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements
| | hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements
| | hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "*
| | Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or
| | "* Implements hook_foo_BAR_ID_bar() for block templates."
203 | ERROR | [x] Expected 1 blank line after function; 2 found
207 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements
| | hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements
| | hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "*
| | Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or
| | "* Implements hook_foo_BAR_ID_bar() for block templates."
209 | ERROR | [ ] taxonomy_subterms_enable() is an installation hook and
| | must be declared in an install file
210 | ERROR | [x] Inline comments must start with a capital letter
213 | ERROR | [x] Expected 1 space before "+"; 0 found
213 | ERROR | [x] Expected 1 space after "+"; 0 found
214 | ERROR | [x] Expected 1 newline at end of file; 0 found
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 49 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...trator/Projects/contribution/taxonomy_subterms/taxonomy_subterms.admin.inc
--------------------------------------------------------------------------------
FOUND 10 ERRORS AFFECTING 9 LINES
--------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
5 | ERROR | [x] There must be exactly one blank line before the tags in a doc
| | comment
5 | ERROR | [x] Whitespace found at end of line
9 | ERROR | [x] Functions must not contain multiple empty lines in a row;
| | found 2 empty lines
10 | ERROR | [x] Whitespace found at end of line
16 | ERROR | [x] Array closing indentation error, expected 2 spaces but found
| | 4
17 | ERROR | [x] Whitespace found at end of line
24 | ERROR | [x] Array closing indentation error, expected 2 spaces but found
| | 4
32 | ERROR | [x] Array closing indentation error, expected 2 spaces but found
| | 4
33 | ERROR | [x] Whitespace found at end of line
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 10 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...ministrator/Projects/contribution/taxonomy_subterms/taxonomy_subterms.info
--------------------------------------------------------------------------------
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: ...trator/Projects/contribution/taxonomy_subterms/taxonomy_subterms.pages.inc
--------------------------------------------------------------------------------
FOUND 65 ERRORS AND 1 WARNING AFFECTING 40 LINES
--------------------------------------------------------------------------------
5 | ERROR | [x] Doc comment short description must start with a capital
| | letter
5 | ERROR | [x] Doc comment short description must end with a full stop
11 | ERROR | [ ] Missing parameter type
13 | ERROR | [ ] Missing parameter type
15 | ERROR | [ ] Missing parameter type
17 | ERROR | [ ] Missing parameter type
22 | ERROR | [x] Parameter comment indentation must be 3 spaces, found 1
| | spaces
26 | ERROR | [x] Concat operator must be surrounded by a single space
26 | ERROR | [x] Concat operator must be surrounded by a single space
27 | ERROR | [x] "require_once" is a statement not a function; no
| | parentheses are required
27 | ERROR | [x] Concat operator must be surrounded by a single space
27 | ERROR | [x] Concat operator must be surrounded by a single space
30 | ERROR | [x] Expected 1 space before "="; 0 found
30 | ERROR | [x] Expected 1 space after "="; 0 found
32 | ERROR | [x] Expected 1 space before "=="; 0 found
32 | ERROR | [x] Expected 1 space after "=="; 0 found
33 | ERROR | [x] No space found before comment text; expected "// only for
| | single term page" but found "//only for single term page"
33 | ERROR | [x] Inline comments must start with a capital letter
33 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
34 | ERROR | [x] Expected 1 space before "="; 0 found
34 | ERROR | [x] Expected 1 space after "="; 0 found
37 | ERROR | [x] No space found before comment text; expected "// only if
| | no depth in URL (and op = page)" but found "//only if no
| | depth in URL (and op = page)"
37 | ERROR | [x] Inline comments must start with a capital letter
38 | ERROR | [x] Expected 1 space before "="; 0 found
38 | ERROR | [x] Expected 1 space after "="; 0 found
39 | ERROR | [x] Expected 1 space before "="; 0 found
39 | ERROR | [x] Expected 1 space after "="; 0 found
40 | ERROR | [x] Whitespace found at end of line
41 | ERROR | [x] Expected 1 space before "="; 0 found
41 | ERROR | [x] Expected 1 space after "="; 0 found
42 | ERROR | [x] Expected 1 space before "=="; 0 found
42 | ERROR | [x] Expected 1 space after "=="; 0 found
43 | ERROR | [x] Expected 1 space before "="; 0 found
43 | ERROR | [x] Expected 1 space after "="; 0 found
45 | ERROR | [x] Expected 1 space before "=="; 0 found
45 | ERROR | [x] Expected 1 space after "=="; 0 found
46 | ERROR | [x] Expected 1 space before "="; 0 found
46 | ERROR | [x] Expected 1 space after "="; 0 found
48 | ERROR | [x] Expected 1 space before "!="; 0 found
48 | ERROR | [x] Expected 1 space after "!="; 0 found
49 | ERROR | [x] Expected 1 space before "="; 0 found
49 | ERROR | [x] Expected 1 space after "="; 0 found
51 | ERROR | [x] Whitespace found at end of line
52 | ERROR | [x] Expected 1 space before "="; 0 found
52 | ERROR | [x] Expected 1 space after "="; 0 found
53 | ERROR | [x] Expected 1 space before "=="; 0 found
53 | ERROR | [x] Expected 1 space after "=="; 0 found
54 | ERROR | [x] Expected 1 space before "="; 0 found
54 | ERROR | [x] Expected 1 space after "="; 0 found
61 | ERROR | [x] Whitespace found at end of line
62 | ERROR | [x] Inline comments must start with a capital letter
62 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
66 | ERROR | [x] Expected 1 space before "="; 0 found
66 | ERROR | [x] Expected 1 space after "="; 0 found
74 | ERROR | [x] Inline control structures are not allowed
78 | ERROR | [x] Missing function doc comment
79 | ERROR | [x] Opening brace should be on the same line as the
| | declaration
81 | ERROR | [x] Expected 1 space before "="; 0 found
81 | ERROR | [x] Expected 1 space after "="; 0 found
82 | ERROR | [x] Expected 1 space after closing parenthesis; found 3
85 | WARNING | [ ] Do not use check_plain() on the first argument of l(),
| | because l() will sanitize it for you by default
86 | ERROR | [x] Expected 1 space before "=="; 0 found
86 | ERROR | [x] Expected 1 space after "=="; 0 found
96 | ERROR | [x] Missing function doc comment
97 | ERROR | [x] Concat operator must be surrounded by a single space
100 | ERROR | [x] Inline control structures are not allowed
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 61 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: /home/administrator/Projects/contribution/taxonomy_subterms/README.txt
----------------------------------------------------------------------------
FOUND 1 ERROR AND 3 WARNINGS AFFECTING 4 LINES
----------------------------------------------------------------------------
4 | WARNING | [ ] Line exceeds 80 characters; contains 99 characters
6 | WARNING | [ ] Line exceeds 80 characters; contains 135 characters
8 | WARNING | [ ] Line exceeds 80 characters; contains 163 characters
24 | ERROR | [x] Expected 1 newline at end of file; 2 found
----------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------
FILE: /home/administrator/Projects/contribution/taxonomy_subterms/LICENSE.txt
-----------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
-----------------------------------------------------------------------------
107 | WARNING | Line exceeds 80 characters; contains 81 characters
121 | WARNING | Line exceeds 80 characters; contains 84 characters
228 | WARNING | Line exceeds 80 characters; contains 81 characters
-----------------------------------------------------------------------------
FILE: ...istrator/Projects/contribution/taxonomy_subterms/taxonomy_subterms.install
--------------------------------------------------------------------------------
FOUND 4 ERRORS AND 3 WARNINGS AFFECTING 7 LINES
--------------------------------------------------------------------------------
11 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements
| | hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements
| | hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "*
| | Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or
| | "* Implements hook_foo_BAR_ID_bar() for block templates."
25 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements
| | hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements
| | hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "*
| | Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or
| | "* Implements hook_foo_BAR_ID_bar() for block templates."
30 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
40 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements
| | hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements
| | hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "*
| | Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or
| | "* Implements hook_foo_BAR_ID_bar() for block templates."
50 | ERROR | [x] Whitespace found at end of line
62 | ERROR | [x] Whitespace found at end of line
67 | ERROR | [x] Expected 1 newline at end of file; 2 found
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------