Skip to content

Commit

Permalink
https://github.com/inc2734/snow-monkey/issues/1332
Browse files Browse the repository at this point in the history
  • Loading branch information
inc2734 committed May 22, 2023
1 parent 312b0dc commit ea126c1
Show file tree
Hide file tree
Showing 16 changed files with 17,780 additions and 98 deletions.
23 changes: 13 additions & 10 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

# WordPress Coding Standards
# https://make.wordpress.org/core/handbook/coding-standards/

root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab

[*.md]
trim_trailing_whitespace = false

[*.{json, yml}]
[*.yml]
indent_style = space
indent_size = 2

[*.php]
indent_style = tab
[*.md]
trim_trailing_whitespace = false
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.DS_Store
vendor/
composer.lock
node_modules/
package-lock.json
85 changes: 53 additions & 32 deletions .phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -1,45 +1,66 @@
<?xml version="1.0"?>
<ruleset name="WordPress Coding Standards">
<description>Sniffs for WordPress plugins, with minor modifications</description>

<rule ref="PHPCompatibility"/>
<config name="testVersion" value="5.6-"/>

<rule ref="WordPress-Core">
<exclude name="Generic.Arrays.DisallowShortArraySyntax.Found"/>
<exclude name="Generic.Commenting.DocComment.MissingShort"/>
<exclude name="Generic.Commenting.DocComment.ShortNotCapital"/>
<exclude name="WordPress.Files.FileName.InvalidClassFileName"/>
<exclude name="Squiz.Commenting.ClassComment.Missing"/>
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar"/>
<exclude name="Squiz.Commenting.FileComment.SpacingAfterComment"/>
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase"/>
</rule>
<rule ref="WordPress-Docs"/>
<rule ref="WordPress.WP.I18n"/>
<config name="text_domain" value="inc2734-wp-seo"/>
<ruleset name="themes">
<description>Apply WordPress Coding Standards to all files</description>

<rule ref="VariableAnalysis.CodeAnalysis.VariableAnalysis">
<properties>
<property name="allowUnusedParametersBeforeUsed" value="true"/>
</properties>
</rule>
<rule ref="WordPress.CodeAnalysis.EmptyStatement"/>
<!-- Only scan PHP files. -->
<arg name="extensions" value="php"/>

<rule ref="PEAR.Functions.FunctionCallSignature">
<properties>
<property name="allowMultipleArguments" value="false"/>
</properties>
</rule>
<!-- Whenever possible, cache the scan results and re-use those for unchanged files on the next scan. -->
<arg name="cache"/>

<!-- Set the memory limit to 256M.
For most standard PHP configurations, this means the memory limit will temporarily be raised.
Ref: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#specifying-phpini-settings
-->
<ini name="memory_limit" value="256M"/>

<!-- Strip the filepaths down to the relevant bit. -->
<arg name="basepath" value="./"/>

<!-- Check up to 20 files simultaneously. -->
<arg name="parallel" value="20"/>

<!-- Show sniff codes in all reports. -->
<arg value="ps"/>
<arg name="extensions" value="php"/>

<file>.</file>

<config name="text_domain" value="inc2734-wp-seo"/>

<rule ref="WordPress-Core"/>
<rule ref="WordPress.CodeAnalysis.EmptyStatement"/>

<!-- These rules are being set as warnings instead of errors, so we can error check the entire codebase. -->
<rule ref="WordPress.PHP.YodaConditions.NotYoda">
<type>warning</type>
</rule>
<rule ref="WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase">
<type>warning</type>
</rule>
<rule ref="WordPress.DB.PreparedSQL.InterpolatedNotPrepared">
<type>warning</type>
</rule>
<rule ref="WordPress.DB.PreparedSQL.NotPrepared">
<type>warning</type>
</rule>
<rule ref="WordPress.Files.FileName.InvalidClassFileName">
<type>warning</type>
</rule>

<!-- Directories and third party library exclusions. -->
<exclude-pattern>/vendor/</exclude-pattern>
<exclude-pattern>/node_modules/</exclude-pattern>
<exclude-pattern>/src/dist/</exclude-pattern>
<exclude-pattern>*/tests/*</exclude-pattern>
<exclude-pattern>*/languages/*</exclude-pattern>
<exclude-pattern>*/languages/*</exclude-pattern>

<!-- Assignments in while conditions are a valid method of looping over iterables. -->
<rule ref="WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition">
<exclude-pattern>*</exclude-pattern>
</rule>

<!-- We're not going to rename files. -->
<rule ref="WordPress.Files.FileName">
<exclude-pattern>*</exclude-pattern>
</rule>
</ruleset>
1 change: 1 addition & 0 deletions .phpunit.result.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":1,"defects":{"Inc2734_WP_SEO_Test::sample":5},"times":{"Inc2734_WP_SEO_Test::sample":0.043}}
18 changes: 10 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@
"inc2734/wp-ogp": "^2.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7",
"squizlabs/php_codesniffer": "^3.5",
"phpcompatibility/php-compatibility": "^9.3",
"wp-coding-standards/wpcs": "^2.3",
"sirbrillig/phpcs-variable-analysis": "^2.10",
"wp-phpunit/wp-phpunit": "^5.6"
"wp-coding-standards/wpcs": "^2.3",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
"yoast/phpunit-polyfills": "^1.0"
},
"authors": [
{
Expand All @@ -26,7 +23,12 @@
}
},
"scripts": {
"format": "phpcbf --standard=./.phpcs.xml.dist --report-summary --report-source",
"lint": "phpcs --standard=./.phpcs.xml.dist"
"lint": "./vendor/squizlabs/php_codesniffer/bin/phpcs",
"format": "./vendor/squizlabs/php_codesniffer/bin/phpcbf"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
Loading

0 comments on commit ea126c1

Please sign in to comment.