2
I want to use php code Sniffer to study and at the same time force me to follow the standards of Psrs but I don’t want to follow the rule that forces me to comment on every file and every function I create.
This rule, in my view, is more disturbing than helping in a study environment. It generates error even in my autoload file and as I did not find an extension in VS Code that gives an autocomplete with the comments when I create a function or when I create a file . php want to remove this requirement from Sniffer code.
Follow the mistakes I get all the time:
Missing file doc comment (PEAR.Commenting.Filecomment.Missing)
Missing doc comment for Function autoload() (PEAR.Commenting.Functioncomment.Missing)
you can configure the rules that your project will follow by creating a configuration file (https://github.com/squizlabs/PHP_CodeSniffer/wiki/Configuration-Options). After configuring the rules according to your goal, configure your extension to use your rules.
– gmsantos
within the Sniffer code directory I renamed the Codesniffer.conf.dist file to Codesniffer.conf and inside it is the config: <? php $phpCodeSnifferConfig = array ( 'default_standard' => 'PSR2', 'report_format' => 'Summary', 'show_warnings' => '0', 'show_progress' => '1', 'report_width' => '120', ) ? > Apparently now only the PSR-2 is working but I would like the others to work as well (Mysource, PEAR, PSR1, PSR12, PSR2, Squiz and Zend)
– Luan Nicolodi
My idea is to just delete the PEAR.Filecomment.Missing and PEAR.Functioncomment.Missing rule. In phpcs.xml you have this possibility of rule deletion but apparently I’m doing it wrong because after adding the rules <exclude name="PEAR.Commenting.Filecomment"/> <exclude name="PEAR.Commenting.Functioncomment"/> Nothing happens
– Luan Nicolodi
For convenience, I would only adopt the PSR-12, which already includes the PSR-1. What might be happening is your phpcs.xml file is not being considered by the extension.
– gmsantos
I believe this is it even though I tried unsuccessfully to find out why it is being disregarded, my solution was exactly this when I specified the PSR-12 the PSR-1 and 2 are in operation and fair they already bring a pleasant to the code. Thank you for your attention and suggestions.
– Luan Nicolodi