Skip to content

Commit

Permalink
Increase commented-out code percentage to 75% (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
asispts committed Nov 3, 2023
1 parent 44e6922 commit 7510051
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions ptscs/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
<rule ref="Squiz.Classes.ClassFileName" />
<rule ref="Squiz.PHP.CommentedOutCode">
<properties>
<!-- Report when > 50% valid code only -->
<property name="maxPercentage" value="50" />
<!-- Report when >= 75% valid code only -->
<property name="maxPercentage" value="74" />
</properties>
</rule>
<rule ref="PEAR.Files.IncludingFile.BracketsNotRequired" />
Expand Down
2 changes: 1 addition & 1 deletion tests/Sniffs/Squiz/CommentedOutCodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static function provideTestData(): Iterator
yield[
[], // Error data
[ // Warning data
new ErrorData(4, 'Squiz.PHP.CommentedOutCode', 'This comment is 60% valid code'),
new ErrorData(13, 'Squiz.PHP.CommentedOutCode', 'This comment is 75% valid code'),
],
];
}
Expand Down
9 changes: 5 additions & 4 deletions tests/Sniffs/Squiz/_data/CommentedOutCode.php.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
/** Contains 50% valid code */
// |<?php

/** Contains 46% valid code */
// function fn()
// {
// }
/** Contains 63% valid code */
// function fn() {}

/** Contains 75% valid code */
/* @var callable|string|null */
9 changes: 5 additions & 4 deletions tests/Sniffs/Squiz/_data/CommentedOutCode.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
/** Contains 50% valid code */
// |<?php

/** Contains 46% valid code */
// function fn()
// {
// }
/** Contains 63% valid code */
// function fn() {}

/** Contains 75% valid code */
/* @var callable|string|null */

0 comments on commit 7510051

Please sign in to comment.