Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update phpcs.xml #48

Closed
hirozed opened this issue Apr 3, 2021 · 1 comment
Closed

Update phpcs.xml #48

hirozed opened this issue Apr 3, 2021 · 1 comment

Comments

@hirozed
Copy link
Contributor

hirozed commented Apr 3, 2021

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>
@hirozed
Copy link
Contributor Author

hirozed commented Apr 3, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants