Skip to content

Commit

Permalink
fix: Indentation sniff tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
seebeen committed Dec 16, 2024
1 parent e66b020 commit c9de725
Show file tree
Hide file tree
Showing 8 changed files with 161 additions and 108 deletions.
15 changes: 14 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
.phpcs.xml export-ignore
/.github export-ignore
/docs export-ignore
/tests export-ignore
/.codeclimate.yml export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.releaserc export-ignore
/CODE_OF_CONDUCT.md export-ignore
/CONTRIBUTING.md export-ignore
/README.md export-ignore
/SECURITY.md export-ignore
/.phpcs.xml export-ignore
/phpunit.xml export-ignore
37 changes: 26 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: Release
name: CI
on:
workflow_dispatch:
push:
branches:
- master
- develop
- alpha
- beta

jobs:
release:
name: Release
Expand All @@ -13,13 +16,25 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.OBLAK_BOT_TOKEN }}
- name: Publish a composer package
uses: better-php-actions/publish-composer-package@v1
token: ${{ secrets.OBLAKBOT_PAT }}
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
id: gpg
with:
package_slug: 'oblak-wordpress-coding-standard'
package_name: 'Oblak WP Coding Standard'
with_gpg: true
gpg_key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }}
release_token: ${{ secrets.OBLAK_BOT_TOKEN }}
gpg_private_key: ${{ secrets.OBLAKBOT_GPG_KEY }}
passphrase: ${{ secrets.OBLAKBOT_GPG_PASS }}
git_config_global: true
git_user_signingkey: true
git_commit_gpgsign: true
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
with:
extra_plugins: |
@semantic-release/github
@semantic-release/exec
env:
GIT_AUTHOR_NAME: ${{ steps.gpg.outputs.name}}
GIT_AUTHOR_EMAIL: ${{ steps.gpg.outputs.email}}
GIT_COMMITTER_NAME: ${{ steps.gpg.outputs.name}}
GIT_COMMITTER_EMAIL: ${{ steps.gpg.outputs.email}}
GITHUB_TOKEN: ${{ secrets.OBLAKBOT_PAT }}
39 changes: 39 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"branches": [
"master",
{
"name": "develop",
"prerelease": true
},
{
"name": "alpha",
"prerelease": true
},
{
"name": "beta",
"prerelease": true
}
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/exec",
{
"prepareCmd": "zip -r '/tmp/release.zip' ./src README.md ./composer.json"
}
],
[
"@semantic-release/github",
{
"assets": [
{
"path": "/tmp/release.zip",
"name": "oblak-wp-coding-standards-v${nextRelease.version}.zip",
"label": "Oblak WordPress Coding Standards v${nextRelease.version}"
}
]
}
]
]
}
Empty file added README.md
Empty file.
130 changes: 59 additions & 71 deletions src/Oblak-Core/ruleset.xml
Original file line number Diff line number Diff line change
@@ -1,112 +1,100 @@
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Oblak WordPress Core coding standard">

<!--
<!--
#############################################################################
BASE CONFIG
#############################################################################
-->
<arg value="sp"/> <!-- Show sniff and progress -->
<arg name="parallel" value="8"/> <!-- Enables parallel processing when available for faster results. -->
<arg name="colors"/> <!-- Show colors -->
<arg name="extensions" value="php"/> <!-- File extensions to check -->
<arg name="tab-width" value="4"/> <!-- Set the tab width -->
<arg value="sp"/> <!-- Show sniff and progress -->
<arg name="parallel" value="8"/> <!-- Enables parallel processing when available for faster results. -->
<arg name="colors"/> <!-- Show colors -->
<arg name="extensions" value="php"/> <!-- File extensions to check -->


<!--
<!--
#############################################################################
EXCLUDE PATTERNS
#############################################################################
-->
<exclude-pattern>dist/*</exclude-pattern>
<exclude-pattern>docker/*</exclude-pattern>
<exclude-pattern>node_modules/*</exclude-pattern>
<exclude-pattern>tests/*</exclude-pattern>
<exclude-pattern>vendor/*</exclude-pattern>
<exclude-pattern>dist/*</exclude-pattern>
<exclude-pattern>docker/*</exclude-pattern>
<exclude-pattern>node_modules/*</exclude-pattern>
<exclude-pattern>tests/*</exclude-pattern>
<exclude-pattern>vendor/*</exclude-pattern>

<!--
<!--
#############################################################################
SET UP THE RULESETS - WordPress
#############################################################################
-->
<rule ref="PHPCompatibilityWP"/>
<rule ref="WordPress-Extra"/>
<rule ref="WordPress-Docs"/>

<rule ref="WordPress-Extra"/>
<rule ref="WordPress-Docs"/>

<!--
<!--
#############################################################################
SET UP THE RULESETS - PHPCsExtra
#############################################################################
-->
<rule ref="Modernize"/>
<rule ref="Universal.Arrays.MixedKeyedUnkeyedArray"/>
<rule ref="Universal.Files.SeparateFunctionsFromOO"/>
<rule ref="Modernize"/>
<rule ref="Universal.Arrays.MixedKeyedUnkeyedArray"/>
<rule ref="Universal.Files.SeparateFunctionsFromOO"/>

<!--
<!--
#############################################################################
Allow normal classnames for autoload
#############################################################################
-->
<rule ref="WordPress-Core">
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase" />
<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
</rule>
<rule ref="WordPress-Core">
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase" />
<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
</rule>

<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter">
<severity>5</severity>
</rule>
<rule ref="Generic.Commenting.Todo"/>
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter">
<severity>5</severity>
</rule>
<rule ref="Generic.Commenting.Todo"/>

<!--
<!--
#############################################################################
Add the default text domains
#############################################################################
-->
<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" type="array">
<element value="default"/>
</property>
</properties>
</rule>
<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" type="array">
<element value="default"/>
</property>
</properties>
</rule>

<!--
<!--
#############################################################################
Use Tabs instead of spaces
#############################################################################
-->
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="4"/>
<property name="tabIndent" value="false"/>
</properties>
</rule>
<rule ref="Generic.WhiteSpace.DisallowTabIndent">
<severity>0</severity>
</rule>
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed">
<severity>0</severity>
</rule>

<!-- Enforce the rule -->
<rule ref="WordPress">
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent" />
</rule>
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="4"/>
<property name="tabIndent" value="false"/>
</properties>
</rule>
<rule ref="Generic.WhiteSpace.DisallowTabIndent" />
-->
<rule ref="WordPress">
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent" />
</rule>
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent">
<severity>0</severity>
</rule>
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="4"/>
<property name="tabIndent" value="false"/>
</properties>
</rule>
<rule ref="Generic.WhiteSpace.DisallowTabIndent" />

<!--
#############################################################################
Modernize dirname always, min php 7.0
#############################################################################
-->
<rule ref="Modernize.FunctionCalls.Dirname.Nested">
<severity>10</severity>
</rule>
<!--
#############################################################################
Modernize dirname always, min php 7.0
#############################################################################
-->
<rule ref="Modernize.FunctionCalls.Dirname.Nested">
<severity>10</severity>
</rule>

</ruleset>
10 changes: 5 additions & 5 deletions src/Oblak-Docs/ruleset.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Oblak WordPress Docs coding standard" >

<!--
<!--
#############################################################################
Include standards
#############################################################################
-->
<rule ref="WordPress-Docs">
<type>warning</type>
</rule>
<rule ref="WordPress-Docs">
<type>warning</type>
</rule>

</ruleset>
</ruleset>
4 changes: 1 addition & 3 deletions src/Oblak-Slevomat/ruleset.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Oblak Slevomat Extension">

<!-- Slevomat Sniffs - Array -->
<!-- Slevomat Sniffs - Array -->
<rule ref="SlevomatCodingStandard.Arrays.AlphabeticallySortedByKeys"/>
<rule ref="SlevomatCodingStandard.Arrays.DisallowImplicitArrayCreation"/>
<rule ref="SlevomatCodingStandard.Arrays.MultiLineArrayEndBracketPlacement"/>
Expand Down Expand Up @@ -53,9 +53,7 @@
<!-- Slevomat Sniffs - Commenting -->
<rule ref="SlevomatCodingStandard.Commenting.DeprecatedAnnotationDeclaration"/>
<rule ref="SlevomatCodingStandard.Commenting.UselessFunctionDocComment"/>

<rule ref="SlevomatCodingStandard.Commenting.EmptyComment"/>

<rule ref="SlevomatCodingStandard.Commenting.UselessInheritDocComment"/>

<!-- Slevomat Sniffs - Complexity -->
Expand Down
34 changes: 17 additions & 17 deletions src/Oblak-WooCommerce/ruleset.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<ruleset name="Oblak-WooCommerce">

<!--
<!--
#############################################################################
Include standards
#############################################################################
-->
<rule ref="WooCommerce"/>
<rule ref="WooCommerce"/>

<!--
<!--
#############################################################################
Custom overrides
#############################################################################
-->
<rule ref="WordPress.Security.ValidatedSanitizedInput">
<rule ref="WordPress.Security.ValidatedSanitizedInput">
<properties>
<property name="customSanitizingFunctions" type="array" value="wc_clean,wc_sanitize_tooltip,wc_format_decimal,wc_stock_amount,wc_sanitize_permalink,wc_sanitize_textarea" />
</properties>
Expand All @@ -24,23 +24,23 @@
</properties>
</rule>

<rule ref="WordPress.Security.EscapeOutput">
<properties>
<property name="customAutoEscapedFunctions" type="array" value="wc_price"/>
</properties>
</rule>
<rule ref="WordPress.Security.EscapeOutput">
<properties>
<property name="customAutoEscapedFunctions" type="array" value="wc_price"/>
</properties>
</rule>

<rule ref="Squiz.Commenting">
<exclude name="Squiz.Commenting.LongConditionClosingComment" />
<exclude name="Squiz.Commenting.PostStatementComment" />
</rule>

<rule ref="WordPress.WP.Capabilities">
<properties>
<property name="custom_capabilities" type="array" >
<element value="manage_woocommerce"/>
</property>
</properties>
</rule>
<rule ref="WordPress.WP.Capabilities">
<properties>
<property name="custom_capabilities" type="array" >
<element value="manage_woocommerce"/>
</property>
</properties>
</rule>

</ruleset>
</ruleset>

0 comments on commit c9de725

Please sign in to comment.