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

chore: update Pressbooks' rule set #17

Draft
wants to merge 2 commits into
base: production
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Pressbooks/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,40 @@
<arg value="s"/>
<!-- Use HM Coding Standards -->
<rule ref="vendor/humanmade/coding-standards">
<!-- TODO sort rules by alphabetical order -->
<!-- Disable rules Pressbooks overrides -->
<exclude name="HM.Security"/>
<exclude name="WordPress.Security.NonceVerification"/>
<!-- Disable rules Pressbooks disagrees with: -->
<exclude name="WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid"/>
<exclude name="WordPress.NamingConventions.ValidVariableName.PropertyNotSnakeCase"/>
<exclude name="Squiz.Commenting"/>
<exclude name="Generic.Commenting.DocComment"/>
<exclude name="WordPress.NamingConventions.ValidVariableName.PropertyNotSnakeCase"/>
<exclude name="WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase"/>
<exclude name="WordPress.PHP.DiscouragedPHPFunctions.system_calls_exec"/>
<exclude name="WordPress.PHP.DiscouragedPHPFunctions.runtime_configuration_ini_set"/>
<exclude name="WordPress.PHP.DiscouragedPHPFunctions.runtime_configuration_putenv"/>
<exclude name="WordPress.PHP.DevelopmentFunctions.error_log_trigger_error"/>
<exclude name="Generic.Formatting.MultipleStatementAlignment.NotSameWarning"/>

<!-- TODO this is temporary, rule fails because WPCS and Coding Standards don't fully support PHP 8 yet -->
<exclude name="Pressbooks.Security.EscapeOutput.OutputNotEscaped" />
</rule>
<!-- Re-enable PSR rules Pressbooks agrees with -->
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
<rule ref="PSR1.Methods.CamelCapsMethodName"/>
<!-- Disable Side Effects rule for cron scripts -->
<rule ref="PSR1.Files.SideEffects">
<exclude-pattern>/*.php</exclude-pattern>
<exclude-pattern>/bin/*</exclude-pattern>
</rule>
<rule ref="HM.Files.NamespaceDirectoryName.NoIncDirectory">
<exclude-pattern>/bin/**/*</exclude-pattern>
</rule>
<!-- Disable Namespaced Functions for cron scripts -->
<rule ref="HM.Functions.NamespacedFunctions">
<exclude-pattern>/bin/*</exclude-pattern>
</rule>
<rule ref="PHPCompatibility"/>
</ruleset>
7 changes: 6 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
},
"require-dev": {
"phpunit/phpunit": "^9.5"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
}