bu-ist / coding-standards

Code style guides for web projects at Boston University.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update phpcs.xml

hirozed opened this issue · comments

There are various rules that we ignore via comment, slow queries being the biggest. However, CodeClimate will flag those comments for not having the proper punctuation, and still flag the ones that are ignored. I'd like to update the phpcs.xml file to reflect the rules we generally ignore to begin with.

<?xml version="1.0"?>
<ruleset name="BU-ID-Defaults">
	<description>Modified ruleset for BU Interactive Design.</description>

	<!--Exclued 3rd party code.-->
	<exclude-pattern>*/node_modules/*</exclude-pattern>
	<exclude-pattern>*/vendor/*</exclude-pattern>

	<!-- Ensure certain file types aren't sniffed -->
	<exclude-pattern>*\.(scss|css|js)</exclude-pattern>

	<rule ref="WordPress">
		<!-- Don't require punctuation after inline comments -->
		<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar"/>

		<!-- Allow empty catch statements -->
		<exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedCatch"/>

		<!-- Comment punctuation doesn't matter -->
		<exclude name="Squiz.Commenting.FunctionComment.ParamCommentFullStop"/>
		<exclude name="Squiz.Commenting.FunctionComment.ThrowsNoFullStop"/>

		<!-- Allow shorthand array syntax -->
		<exclude name="Generic.Arrays.DisallowShortArraySyntax.Found"/>

		<!-- Don't worry about slow queries -->
		<exclude name="WordPress.DB.SlowDBQuery"/>

		<!-- This nonce sniff almost never works right -->
		<exclude name="WordPress.Security.NonceVerification.Missing"/>
	</rule>

	<!-- Sets the minimum supported WP version to 5.4. -->
	<config name="minimum_supported_wp_version" value="5.4" />

	<!-- Make missing translator comment a warning. -->
	<rule ref="WordPress.WP.I18n.MissingTranslatorsComment">
		<type>warning</type>
	</rule>

	<!-- Sometimes we need to override globals -->
	<rule ref="WordPress.WP.GlobalVariablesOverride.OverrideProhibited">
		<type>warning</type>
	</rule>

</ruleset>

There might be others to add, but this is what I have started with. The ruleset is currently being used in https://github.com/bu-ist/r-sustainability