Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase commented-out code percentage to 75% #15

Merged
merged 1 commit into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 */