Closed tdmalone closed 6 years ago
Hello,
Apologies for adding noise here
Please, do not apology :-). It has not been clarified in the README.md
, your question is perfectly expected and normal.
Neutron is the name of a team inside Automattic. We have more needs than WP CS, hence this set of rules in this repository. At one point in a far future, it might be merged in the WP CS, but that's not the goal.
Most notably, WPCS sticks to PHP 5.2. This standard uses things like namespaces, typehints, and array shorthand designed for PHP 7+. Internally we use it on top of WPCS and variable-analysis with a bunch of disabled rules. I should probably put those disabled rules in here somewhere.
I've considered including the WPCS standard as a dependency of this standard, but I kind of like the idea that people can get specific sniffs from different packages; none of these are really WP-specific.
Thank you for the clarification! I would love to see those disabled rules; we’ve done much the same with WPCS. Our config is at https://github.com/ChromatixAU/phpcs-config-chromatix (but I must caveat that we are still learning how to use phpcs so there’s quite a few useful rules disabled until we figure out how to configure or rewrite them)
@tdmalone it looks like this, currently:
<?xml version="1.0"?>
<ruleset name="MyStandard">
<description>My library.</description>
<rule ref="VariableAnalysis"/>
<rule ref="NeutronStandard"/>
<rule ref="WordPress"/>
<rule ref="Squiz.Commenting">
<severity>0</severity>
</rule>
<rule ref="WordPress.Files.FileName">
<severity>0</severity>
</rule>
<rule ref="WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid">
<severity>0</severity>
</rule>
<rule ref="WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned">
<severity>0</severity>
</rule>
<rule ref="Generic.Formatting.MultipleStatementAlignment.NotSameWarning">
<severity>0</severity>
</rule>
<rule ref="Generic.Commenting.DocComment.MissingShort">
<severity>0</severity>
</rule>
<rule ref="WordPress.PHP.YodaConditions.NotYoda">
<severity>0</severity>
</rule>
</ruleset>
Cool to see more phpcs standards out there! If it helps, I wrote about my experiences creating sniffs on my blog. Possibly of use to your standard from the post: adding a directory above your Sniffs
directory so you can have a standard name which is not the name of your package (eg: <rule ref="Chromatix"/>
), and the type
field of your composer.json being set to phpcodesniffer-standard
so that it can be used without having to all the phpcs --config-set installed_paths
stuff.
@sirbrillig Thank you! Really appreciate your guidance. I have adding your blog post to my reading list. 👍
Hallo. I came across this repo and I like the look of the standard... but I'm curious what Neutron is, where it's used, and how it is considered as opposed to WPCS. It seems like a more modern version of WPCS... and I'm intrigued, because we use WPCS internally and might be interested in replacing it with this.
Apologies for adding noise here; I can't seem to find anything relevant online about Neutron + WordPress :)