coverageChecker icon indicating copy to clipboard operation
coverageChecker copied to clipboard

Removing a phpdoc will not checked by the diffFilter

Open cydrickn opened this issue 4 years ago • 2 comments

I have an issue, I tested this scenario where we remove a php comment docs. But that doc is needed for phpcs to check. But what happen it went out it passed the checker.

diff.text

diff --git a/<path>/country_controller.php b/<path>/country_controller.php
index 0965de3e93..73afffd042 100644
--- a/<path>/country_controller.php
+++ b/<path>/country_controller.php
@@ -1,13 +1,4 @@
 <?php
-/**
- * Controller to retrieve information about a country
- *
- * PHP version 5
- *
- * @author    Sample Author <[email protected]>
- * @copyright Sample Copyright
- */
 namespace <namespace>;
 
 class Country_Controller extends Base_Controller {

phpcs.json

{
  "totals": {
    "errors": 3,
    "warnings": 0
  },
  "files": {
     "<path>\/country_controller.php": {
      "errors": 1,
      "warnings": 0,
      "messages": [
        {
          "message": "Missing file doc comment",
          "source": "CSNStores.Commenting.FileComment.Missing",
          "severity": 5,
          "type": "ERROR",
          "line": 2,
          "column": 1
        }
      ]
    }
  }
}

the output of the difffilter will be

php ./.ci/diffFilter.phar --phpcsStrict diff.txt phpcs.json
    100.00% Covered

The expected for this, it should have an error.

cydrickn avatar Dec 17 '21 03:12 cydrickn

Hi!

Thanks for reporting this, is your company CSNStores?

There are over rides for this https://github.com/exussum12/coverageChecker/blob/master/src/Loaders/PhpCs.php#L35

I have added the squiz sniffs, I could make that user configurable too, If that is a public sniff (I can't see it from a quick google) I will add to the base config, if not I can make that array be adjusted by a users config.

I raised an issue a while back on phpcs as that error is not really on line 2, its the whole file in that case. It was discussed a while back https://github.com/squizlabs/PHP_CodeSniffer/issues/1680#issuecomment-333738127

exussum12 avatar Dec 17 '21 09:12 exussum12

CSNStores.Commenting.FileComment.Missing is our own rule

cydrickn avatar Jan 04 '22 13:01 cydrickn