Menu
  • HOME
  • TAGS

Including and excluding globbing patterns in bash

php,bash,wildcard,glob,phpcodesniffer

End your -exec option with + instead of \;. That tells find to run the command once with all the filenames, rather than separately for each filename. find ./path1 ./path2 ./path3 ./path4 \ -type f \ -name '*.php' \ -not -path './path4/dontwantthis/*' \ -exec ./vendor/bin/phpcs \ --standard=PHPCompatibility --runtime-set testVersion 5.6...

phpcs - Set default message type to warning for all snips from a custom ruleset

php,coding-style,phpcodesniffer

No, this is not possible in PHP_CodeSniffer. You can only change the type of specific message codes and not entire rulesets, categories or sniff files. If you had control over the WordPress standard, you could use a custom config option to let users specify if the Doc standard should use...

Identify if PHP_CodeSniffer is Sniffing an abstract (or final) class

php,phpcodesniffer

Thanks to zerkms for pointing me in the right direction. To check if the current Sniff is reading an abstract or final class, use the following code: if (in_array( $tokens[($stackPtr - 2)]['code'], array(T_ABSTRACT, T_FINAL) ) === true ) { // TRUE - class is abstract or final } else {...

Codesniffer to check for whitespace lines

codesniffer,phpcodesniffer

You might want to try this sniff: https://github.com/squizlabs/PHP_CodeSniffer/blob/master/CodeSniffer/Standards/Squiz/Sniffs/WhiteSpace/SuperfluousWhitespaceSniff.php Include it in your ruleset.xml file using: <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace" /> It will look for whitespace at the end of any line, start and end of a file, and multiple blank lines in a row (even if they don't contain spaces). You can...