vralfy / phpcsmd

Netbeans plugin to report code measurements generated by phpcs, phpmd, phpcpd and pdepend as Tasks and Annotations
27 stars 6 forks source link

change "ignore regex" setting default value #17

Closed fonsecas72 closed 11 years ago

fonsecas72 commented 11 years ago

Maybe the "ignore regex" should be changed so phpcsmd doesn't check for doc, xls, pdf, etc...

I suggest something like this:

^.*\.(?!php$|js$|css$|yml$|inc$|php3$|php4$|php5$|phps$|phtml$)[^.]+$

This way it will ignore everything that's not "checkable".

fonsecas72 commented 11 years ago

Or maybe phpcsmd could just change its logic and instead of "ignore this extensions/files" it could be "check this extensions/files" and have php - js and css files by default. (?)

vralfy commented 11 years ago

What about supporting both? Let the user decide if he/she wants to ignore or include specific regex

fonsecas72 commented 11 years ago

supporting both seams good, but how do you plan to do that? making up that regex that I've made may be too difficult for a user not familiar to regex language. also, is it possible that someone wants to validate a pdf file? because wright now that's the default behavior when you check a whole dir.

fonsecas72 commented 11 years ago

Ok, this works. It would be better for me as a user if I just put "php,css,js" or "java,txt,png,jpg,gif" instead of editing a regex but for now this is enough. You may close this issue or save it for later improvements ;)

fonsecas72 commented 11 years ago

Oh, this is missing from project properties!

vralfy commented 11 years ago

That's why i didn't closed it :D

fonsecas72 commented 11 years ago

In eclipse we could use patterns to ignore files or folders. We could just do: "/folder/,file.js,/anotherfolder/,anotherfile.php" And this whole folders and files are ignored. I don't know if it is possible/easy enough to apply this logic here but maybe in the eclipse plugin we can learn something ;) https://github.com/PHPsrc/org.phpsrc.eclipse.pti.tool.codesniffer/blob/master/src/org/phpsrc/eclipse/pti/tools/codesniffer/core/PHPCodeSniffer.java

https://github.com/PHPsrc/org.phpsrc.eclipse.pti.tool.codesniffer

vralfy commented 11 years ago

Could you test if this works for you?

fonsecas72 commented 11 years ago

I don't think so...I've try to ignore (by using both ways) php files and they are beeing scanned even after netbeans restart. This are the settings being save (don't know if that helps :p)

phpcsmd.phpcs.standard=/var/www/project/build/CS
phpcsmd.general.ignorepattern=\\.(svn|git)|\\.(phtml|html|xml|txt|java|svg|png|jpg|gif|php)$
phpcsmd.general.includepattern=(?\!.*\\.(svn|git))(\\.(css|js|php3|php4|php5))$
phpcsmd.general.includestrategy=false
vralfy commented 11 years ago

Tested several times. Works for me now.