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

Request #19899 Exclude files like compressed JS based on e.g. size
Submitted: 2013-04-16 18:37 UTC
From: ogmueller Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.4.5)
PHP Version: 5.4.8 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2013-04-16 18:37 UTC] ogmueller (Oliver Mueller)
Description: ------------ Many projects are using more and more JavaScript. In order to increase performance on the production systems it is recommended to minify or compress those JS files into one big file. It is not unusual that those files have a size of more than 1MB. The issue that occurs with CodeSniffer is, that CodeSniffer needs forever to parse a file of this size. In our case it will need quite some HOURS to do so, without having started a sniff! It is also hard to exclude them by a name pattern because different library using different patterns to name these files (e.g. *_min.hs, *.min.js, *-debug.js, ...). Would it be possible to set something like a file size limit or alike? Or could you offer an extendable hook while you are collecting/adding files? And/Or could you do the parsing lazily, so it will be done only if needed (e.g. if someone is doing a "$phpcsFile->getTokens()"? Test script: --------------- Just try to do a JS lint test or anything like that on a file, that is bigger than 1MB (http://cdn.sencha.io/ext-4.0.7-gpl/ext-all-debug.js or http://cdn.sencha.io/ext-4.0.7-gpl/ext-all.js). Expected result: ---------------- A solution to exclude those files other than a name pattern exclusion. Actual result: -------------- Not possible.

Comments

 [2013-07-10 14:30 UTC] alex_le (Alexander Opitz)
It looks like an invinite loop, so its more a bug. (Also happens with 1.5.0RC2).
 [2013-07-26 16:23 UTC] fonsecas72 (hugo fonseca)
I think this is related to "Request #19881 Maximum number of errors". I think this happens with minified CSS files too. Maybe we should delete #19881 issue and add that information here.
 [2014-09-16 08:13 UTC] squiz (Greg Sherwood)
-Status: Open +Status: Closed -Assigned To: +Assigned To: squiz
See https://github.com/squizlabs/PHP_CodeSniffer/issues/252 for a discussion and resolution.