Skip to content

Commit 64b33d9

Browse files
committed
aagh clean commits
1 parent 0cd1510 commit 64b33d9

5 files changed

Lines changed: 32 additions & 14 deletions

File tree

.aagh/pre-commit

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
files=$(git diff --cached --name-only --diff-filter=ACM | { grep '.php$' || true; })
2+
[ -z "$files" ] && exit 0
3+
4+
failed=$(composer run lint $files 2>&1 | grep 'FILE: ' | cut -d ' ' -f2 | tr '\n' ' ')
5+
[ -z "$failed" ] && exit 0
6+
7+
echo >&2 "Files incorrectly formatted. Try running:"
8+
echo >&2 " composer run fix $failed"
9+
10+
exit 1

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
* text=auto
22

3+
.aagh export-ignore
34
.editorconfig export-ignore
45
.gitattributes export-ignore
56
.gitignore export-ignore

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.DS_Store
22
/.idea/
3+
/.vscode/
34
/bin/
45
/tests/

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
]
4141
},
4242
"scripts": {
43-
"lint": "phpcs --colors -p -s -v",
44-
"fix": "phpcbf -p -v"
43+
"lint": "phpcs",
44+
"fix": "phpcbf"
4545
}
4646
}

phpcs.xml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
<?xml version="1.0"?>
2-
<ruleset name="Augment Types">
2+
<ruleset
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/PHPCSStandards/PHP_CodeSniffer/master/phpcs.xsd"
5+
name="Augment Types"
6+
>
37
<!-- Set a description for this ruleset. -->
48
<description>The code standard rules for Augment Types.</description>
59

610
<!-- Strip the file paths down to the relevant bit. -->
7-
<arg name="basepath" value="./" />
11+
<arg name="basepath" value="." />
812
<!-- A comma separated list of file extensions to check. -->
913
<arg name="extensions" value="php" />
1014
<!-- Show sniff and progress. -->
@@ -17,21 +21,23 @@
1721
<!-- What to scan. -->
1822
<file>.</file>
1923
<!-- Exclude the Composer Vendor directory. -->
20-
<exclude-pattern>/vendor/</exclude-pattern>
21-
22-
<!-- Include the WordPress ruleset. -->
23-
<rule ref="WordPress-Extra" />
24-
25-
<rule ref="WordPress.Files.FileName">
26-
<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
27-
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase" />
28-
</rule>
24+
<exclude-pattern>vendor</exclude-pattern>
2925

3026
<!-- Include PHP cross-version compatibility. -->
3127
<config name="testVersion" value="5.6-" />
3228
<!-- Include minimum supported WP version. -->
3329
<config name="minimum_supported_wp_version" value="4.6" />
3430

35-
<!-- Include PHP Compatibility Coding Standard for WordPress. -->
31+
<!-- Include PHP Compatibility Coding Standard. -->
3632
<rule ref="PHPCompatibilityWP" />
33+
<!-- Include the WordPress ruleset. -->
34+
<rule ref="WordPress-Extra" />
35+
36+
<!-- Custom Rules -->
37+
<rule ref="WordPress.Files">
38+
<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
39+
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase" />
40+
<exclude name="PSR2.Methods.FunctionClosingBrace.SpacingBeforeClose" />
41+
<exclude name="PSR2.Classes.ClassDeclaration.CloseBraceAfterBody" />
42+
</rule>
3743
</ruleset>

0 commit comments

Comments
 (0)