After checking for Drupal coding standards following errors were found

FILE: C:\Users\Administrator\Sites\devdesktop\drupal8practice\modules\term_depth_condition\src\Plugin\Condition\TermDepth.php
-----------------------------------------------------------------------------------------------------------------------------
FOUND 12 ERRORS AFFECTING 12 LINES
-----------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
3 | ERROR | [x] Namespaced classes, interfaces and traits should not begin with a file doc comment
28 | ERROR | [x] Additional blank lines found at end of doc comment
32 | ERROR | [x] Function comment short description must start with exactly one space
34 | ERROR | [x] Data types in @var tags need to be fully namespaced
41 | ERROR | [x] Data types in @param tags need to be fully namespaced
62 | ERROR | [x] Opening brace should be on the same line as the declaration
81 | ERROR | [x] Short array syntax must be used to define arrays
98 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
99 | ERROR | [x] Array closing indentation error, expected 4 spaces but found 6
121 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, colons, question marks, or closing parentheses
164 | ERROR | [x] Short array syntax must be used to define arrays
-----------------------------------------------------------------------------------------------------------------------------

Comments

Rutuj created an issue. See original summary.

rutuj’s picture

i am providing a patch to fix this issue

Deepthi kumari’s picture

Status: Active » Needs review
StatusFileSize
new3.28 KB

The above patch looks fine but found a small end of line issue in phpcs as below

FILE: E:\xampp\htdocs\skdrupal\web\modules\contrib\term_depth_condition\src\Plugin\Condition\TermDepth.php
----------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
----------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------

Time: 4.35 secs; Memory: 10MB

Fixed the issue and applied patch.

silvi.addweb’s picture

StatusFileSize
new3.34 KB

Found one issue which I've solved in this patch

--------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------
 80 | ERROR | [x] Use null coalesce operator instead of ternary operator.
--------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------
cleavinjosh’s picture

Hi @silvi.addweb,

I applied patch#4, it was applied smoothly and fixed the phpcs issues.

➜  term_depth_condition git:(8.x-1.x) curl https://www.drupal.org/files/issues/2024-05-30/3077207-4.patch | patch -p1
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3424  100  3424    0     0   8412      0 --:--:-- --:--:-- --:--:--  8433
patching file src/Plugin/Condition/TermDepth.php
➜  term_depth_condition git:(8.x-1.x) ✗ ..
➜  contrib phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml term_depth_condition
➜  contrib

RTBC+1 for me.
Thank you.