Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 3.4.2

Bug #20355 No sniffs are registered with PHAR on Windows
Submitted: 2014-07-30 16:44 UTC
From: mikaeljorhult Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 2.0.0a2)
PHP Version: 5.5.15 OS: Windows 7/8/8.1
Roadmaps: (Not assigned)    
Subscription  


 [2014-07-30 16:44 UTC] mikaeljorhult (Mikael Jorhult)
Description: ------------ When using the PHAR on Windows 7 command line CodeSniffer wont detect any issues with malformatted code. Using verbose output I noticed that it seems to be because of no sniffs being registered. Running it on OS X will work but will produce some PHP warnings that may be related to spaces in the path to the PHAR. Test script: --------------- php phpcs.phar -v --standard=PSR1,PSR2 test.php Expected result: ---------------- Registering sniffs in the PSR1 standard... Registering sniffs in the PSR2 standard... DONE (40 sniffs registered) Creating file list... DONE (1 files in queue) Actual result: -------------- Registering sniffs in the standard... Registering sniffs in the standard... DONE (0 sniffs registered) Creating file list... DONE (1 files in queue)

Comments

 [2014-07-30 16:54 UTC] mikaeljorhult (Mikael Jorhult)
Full output from OS X terminal, including stacktrace, showing the PHP warnings: $ php phpcs.phar -v --standard=PSR1,PSR2 test.php PHP Warning: simplexml_load_file(): I/O warning : failed to load external entity "phar:///Users/mikaeljorhult/Dropbox/Projekt/Brackets%20PHP%20Code%20Quality%20Tools/Source/modules/vendor/phpcs/phpcs.phar/CodeSniffer/Standards/PSR1/ruleset.xml" in phar:///Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar/CodeSniffer.php on line 516 PHP Stack trace: PHP 1. {main}() /Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar:0 PHP 2. PHP_CodeSniffer_CLI->runphpcs() /Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar:5 PHP 3. PHP_CodeSniffer_CLI->process() phar:///Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar/CodeSniffer/CLI.php:91 PHP 4. PHP_CodeSniffer->initStandard() phar:///Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar/CodeSniffer/CLI.php:727 PHP 5. simplexml_load_file() phar:///Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar/CodeSniffer.php:516 Warning: simplexml_load_file(): I/O warning : failed to load external entity "phar:///Users/mikaeljorhult/Dropbox/Projekt/Brackets%20PHP%20Code%20Quality%20Tools/Source/modules/vendor/phpcs/phpcs.phar/CodeSniffer/Standards/PSR1/ruleset.xml" in phar:///Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar/CodeSniffer.php on line 516 Call Stack: 0.0016 416408 1. {main}() /Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar:0 0.0118 1536776 2. PHP_CodeSniffer_CLI->runphpcs() /Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar:5 0.0123 1588824 3. PHP_CodeSniffer_CLI->process() phar:///Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar/CodeSniffer/CLI.php:91 0.0143 1600208 4. PHP_CodeSniffer->initStandard() phar:///Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar/CodeSniffer/CLI.php:727 0.0143 1601976 5. simplexml_load_file() phar:///Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar/CodeSniffer.php:516 PHP Notice: Undefined variable: standardName in phar:///Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar/CodeSniffer.php on line 521 PHP Stack trace: PHP 1. {main}() /Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar:0 PHP 2. PHP_CodeSniffer_CLI->runphpcs() /Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar:5 PHP 3. PHP_CodeSniffer_CLI->process() phar:///Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar/CodeSniffer/CLI.php:91 PHP 4. PHP_CodeSniffer->initStandard() phar:///Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar/CodeSniffer/CLI.php:727 Notice: Undefined variable: standardName in phar:///Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar/CodeSniffer.php on line 521 Call Stack: 0.0016 416408 1. {main}() /Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar:0 0.0118 1536776 2. PHP_CodeSniffer_CLI->runphpcs() /Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar:5 0.0123 1588824 3. PHP_CodeSniffer_CLI->process() phar:///Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar/CodeSniffer/CLI.php:91 0.0143 1600208 4. PHP_CodeSniffer->initStandard() phar:///Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar/CodeSniffer/CLI.php:727 Registering sniffs in the standard... PHP Warning: simplexml_load_file(): I/O warning : failed to load external entity "phar:///Users/mikaeljorhult/Dropbox/Projekt/Brackets%20PHP%20Code%20Quality%20Tools/Source/modules/vendor/phpcs/phpcs.phar/CodeSniffer/Standards/PSR2/ruleset.xml" in phar:///Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar/CodeSniffer.php on line 516 PHP Stack trace: PHP 1. {main}() /Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar:0 PHP 2. PHP_CodeSniffer_CLI->runphpcs() /Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar:5 PHP 3. PHP_CodeSniffer_CLI->process() phar:///Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar/CodeSniffer/CLI.php:91 PHP 4. PHP_CodeSniffer->initStandard() phar:///Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar/CodeSniffer/CLI.php:727 PHP 5. simplexml_load_file() phar:///Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar/CodeSniffer.php:516 Warning: simplexml_load_file(): I/O warning : failed to load external entity "phar:///Users/mikaeljorhult/Dropbox/Projekt/Brackets%20PHP%20Code%20Quality%20Tools/Source/modules/vendor/phpcs/phpcs.phar/CodeSniffer/Standards/PSR2/ruleset.xml" in phar:///Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar/CodeSniffer.php on line 516 Call Stack: 0.0016 416408 1. {main}() /Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar:0 0.0118 1536776 2. PHP_CodeSniffer_CLI->runphpcs() /Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar:5 0.0123 1588824 3. PHP_CodeSniffer_CLI->process() phar:///Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar/CodeSniffer/CLI.php:91 0.0143 1600208 4. PHP_CodeSniffer->initStandard() phar:///Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar/CodeSniffer/CLI.php:727 0.0177 1608640 5. simplexml_load_file() phar:///Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar/CodeSniffer.php:516 PHP Notice: Undefined variable: standardName in phar:///Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar/CodeSniffer.php on line 521 PHP Stack trace: PHP 1. {main}() /Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar:0 PHP 2. PHP_CodeSniffer_CLI->runphpcs() /Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar:5 PHP 3. PHP_CodeSniffer_CLI->process() phar:///Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar/CodeSniffer/CLI.php:91 PHP 4. PHP_CodeSniffer->initStandard() phar:///Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar/CodeSniffer/CLI.php:727 Notice: Undefined variable: standardName in phar:///Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar/CodeSniffer.php on line 521 Call Stack: 0.0016 416408 1. {main}() /Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar:0 0.0118 1536776 2. PHP_CodeSniffer_CLI->runphpcs() /Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar:5 0.0123 1588824 3. PHP_CodeSniffer_CLI->process() phar:///Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar/CodeSniffer/CLI.php:91 0.0143 1600208 4. PHP_CodeSniffer->initStandard() phar:///Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/phpcs.phar/CodeSniffer/CLI.php:727 Registering sniffs in the standard... DONE (40 sniffs registered) Creating file list... DONE (1 files in queue) Changing into directory /Users/mikaeljorhult/Dropbox/Projekt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs Processing test.php [PHP => 27 tokens in 6 lines]... DONE in 6ms (9 errors, 0 warnings) FILE: ...kt/Brackets PHP Code Quality Tools/Source/modules/vendor/phpcs/test.php -------------------------------------------------------------------------------- FOUND 9 ERRORS AFFECTING 4 LINES -------------------------------------------------------------------------------- 3 | ERROR | [ ] Each class must be in a namespace of at least one level (a | | top-level vendor name) 3 | ERROR | [x] Opening brace of a class must be on the line after the | | definition 3 | ERROR | [ ] Visibility must be declared on method "theFunction" 3 | ERROR | [x] Opening brace should be on a new line 4 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed 4 | ERROR | [x] Line indented incorrectly; expected at least 4 spaces, found 2 5 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed 5 | ERROR | [x] Closing brace indented incorrectly; expected 0 spaces, found 1 6 | ERROR | [x] Expected 1 newline at end of file; 0 found -------------------------------------------------------------------------------- PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY -------------------------------------------------------------------------------- Time: 39ms; Memory: 3.5Mb
 [2014-08-04 05:58 UTC] squiz (Greg Sherwood)
-Summary: No sniffs are registered with PHAR +Summary: No sniffs are registered with PHAR on Windows -Assigned To: +Assigned To: squiz
In my testing, the OS X issue was only present when using the verbose option, and has been fixed here: https://github.com/squizlabs/PHP_CodeSniffer/commit/e37732cd974198a8e636a90ec 9822e483194770e I still need to look into the Windows problem.
 [2014-08-04 06:32 UTC] squiz (Greg Sherwood)
-Status: Assigned +Status: Closed
Fix for Win committed here: https://github.com/squizlabs/PHP_CodeSniffer/commit/ed5aed8d3b55b144f1cc8ecddb b240c43a5e4eed