Skip to content

Commit

Permalink
Disallow commenting out code
Browse files Browse the repository at this point in the history
  • Loading branch information
nicwortel committed Jun 15, 2023
1 parent d0efaec commit 5c5888a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions NicWortel/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,7 @@
@type"/>
</properties>
</rule>

<!-- Disallow commented out code -->
<rule ref="Squiz.PHP.CommentedOutCode"/>
</ruleset>
1 change: 1 addition & 0 deletions tests/expected.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"tests/incorrect/arrays.php",10,5,error,"Multi-line arrays must have a trailing comma after the last element.",SlevomatCodingStandard.Arrays.TrailingArrayComma.MissingTrailingComma,5,1
"tests/incorrect/arrays.php",5,20,error,"Short array syntax must be used to define arrays",Generic.Arrays.DisallowLongArraySyntax.Found,5,1
"tests/incorrect/class-constant-visibility.php",9,5,error,"Visibility must be declared on all constants if your project supports PHP 7.1 or later",PSR12.Properties.ConstantVisibility.NotFound,5,0
"tests/incorrect/commented-out-code.php",5,1,warning,"This comment is 50% valid code; is this commented out code?",Squiz.PHP.CommentedOutCode.Found,5,0
"tests/incorrect/commenting.php",10,4,error,"Use of annotation @version is forbidden.",SlevomatCodingStandard.Commenting.ForbiddenAnnotations.AnnotationForbidden,5,1
"tests/incorrect/commenting.php",11,4,error,"Use of annotation @package is forbidden.",SlevomatCodingStandard.Commenting.ForbiddenAnnotations.AnnotationForbidden,5,1
"tests/incorrect/commenting.php",12,4,error,"Use of annotation @copyright is forbidden.",SlevomatCodingStandard.Commenting.ForbiddenAnnotations.AnnotationForbidden,5,1
Expand Down
8 changes: 8 additions & 0 deletions tests/incorrect/commented-out-code.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

declare(strict_types=1);

//function foo(): string
//{
// return 'foo';
//}

0 comments on commit 5c5888a

Please sign in to comment.