Skip to content

Commit 459049f

Browse files
committed
initial commit
0 parents  commit 459049f

File tree

8 files changed

+595
-0
lines changed

8 files changed

+595
-0
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## ide
2+
.idea
3+
4+
## composer
5+
vendor
6+
composer.lock

bin/codefixer

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4+
RULESET=${RULESET:='ruleset.xml'}
5+
EXTENSIONS=${EXTENSIONS:='php,phtml,phpt'}
6+
EXCLUDE_FOLDERS=${EXCLUDE_FOLDERS:='*/temp,*/tmp'}
7+
FOLDERS=()
8+
9+
# Try several ruleset paths:
10+
# - <package-dir>/$RULESET
11+
# - <package-dir>/$RULESET.xml
12+
# - <vendor-dir>/warengo/qa/ruleset.xml
13+
if [ -f "${DIR}/../../${RULESET}" ]; then
14+
RULESET="${DIR}/../../${RULESET}"
15+
elif [ -f "${DIR}/../../${RULESET}.xml" ]; then
16+
RULESET="${DIR}/../../${RULESET}.xml"
17+
else
18+
RULESET="${DIR}/../warengo/qa/ruleset.xml"
19+
fi
20+
21+
# Show installed coding standards
22+
${DIR}/phpcs -i
23+
24+
# Run fixing
25+
if [ -z "$1" ]; then
26+
# Run codefixer with default args
27+
[ -d "app" ] && FOLDERS+=('app')
28+
[ -d "src" ] && FOLDERS+=('src')
29+
[ -d "tests" ] && FOLDERS+=('tests')
30+
${DIR}/phpcbf --standard="${RULESET}" --ignore="${EXCLUDE_FOLDERS}" --extensions="${EXTENSIONS}" --colors --encoding=utf-8 -nsp ${FOLDERS[*]}
31+
else
32+
# Run codefixer
33+
${DIR}/phpcbf --standard="${RULESET}" --ignore="${EXCLUDE_FOLDERS}" --extensions="${EXTENSIONS}" --colors --encoding=utf-8 -nsp $@
34+
fi

bin/codesniffer

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4+
RULESET=${RULESET:='ruleset.xml'}
5+
EXTENSIONS=${EXTENSIONS:='php,phtml,phpt'}
6+
EXCLUDE_FOLDERS=${EXCLUDE_FOLDERS:='*/temp,*/tmp'}
7+
FOLDERS=()
8+
9+
# Try several ruleset paths:
10+
# - <package-dir>/$RULESET
11+
# - <package-dir>/$RULESET.xml
12+
# - <vendor-dir>/warengo/qa/ruleset.xml
13+
if [ -f "${DIR}/../../${RULESET}" ]; then
14+
RULESET="${DIR}/../../${RULESET}"
15+
elif [ -f "${DIR}/../../${RULESET}.xml" ]; then
16+
RULESET="${DIR}/../../${RULESET}.xml"
17+
else
18+
RULESET="${DIR}/../warengo/qa/ruleset.xml"
19+
fi
20+
21+
# Show installed coding standards
22+
${DIR}/phpcs -i
23+
24+
# Run sniffing
25+
if [ -z "$1" ]; then
26+
# Run codesniffer with default args
27+
[ -d "app" ] && FOLDERS+=('app')
28+
[ -d "src" ] && FOLDERS+=('src')
29+
[ -d "tests" ] && FOLDERS+=('tests')
30+
${DIR}/phpcs --standard="${RULESET}" --ignore="${EXCLUDE_FOLDERS}" --extensions="${EXTENSIONS}" --encoding=utf-8 --colors -nsp ${FOLDERS[*]}
31+
else
32+
# Run codesniffer
33+
${DIR}/phpcs --standard="${RULESET}" --ignore="${EXCLUDE_FOLDERS}" --extensions="${EXTENSIONS}" --encoding=utf-8 --colors -nsp $@
34+
fi

bin/linter

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4+
EXTENSIONS=${EXTENSIONS:='php,php3,php4,php5,phtml,phpt'}
5+
EXCLUDE_FOLDERS=${EXCLUDE_FOLDERS:='vendor'}
6+
FOLDERS=()
7+
8+
if [ -z "$1" ]; then
9+
# Run linter with default args
10+
[ -d "app" ] && FOLDERS+=('app')
11+
[ -d "src" ] && FOLDERS+=('src')
12+
[ -d "tests" ] && FOLDERS+=('tests')
13+
${DIR}/parallel-lint -e ${EXTENSIONS[*]} --exclude ${EXCLUDE_FOLDERS} --blame ${FOLDERS[*]}
14+
else
15+
# Run linter
16+
${DIR}/parallel-lint -e ${EXTENSIONS[*]} --exclude ${EXCLUDE_FOLDERS} --blame $@
17+
fi

composer.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "utilitte/qa",
3+
"description": "Utilitte quality assurance",
4+
"require": {
5+
"php": ">= 7.3",
6+
"slevomat/coding-standard": "~6.3.2",
7+
"squizlabs/php_codesniffer": "^3.3.1",
8+
"php-parallel-lint/php-console-highlighter": "^0.4.0",
9+
"php-parallel-lint/php-parallel-lint": "^1.2.0"
10+
},
11+
"bin": [
12+
"bin/codesniffer",
13+
"bin/codefixer",
14+
"bin/linter"
15+
]
16+
}

phpstorm/utilitte.xml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<code_scheme name="utilitte" version="173">
2+
<PHPCodeStyleSettings>
3+
<option name="COMMA_AFTER_LAST_ARRAY_ELEMENT" value="true" />
4+
<option name="PHPDOC_BLANK_LINE_BEFORE_TAGS" value="true" />
5+
<option name="ANONYMOUS_BRACE_STYLE" value="2" />
6+
<option name="LOWER_CASE_BOOLEAN_CONST" value="true" />
7+
<option name="LOWER_CASE_NULL_CONST" value="true" />
8+
<option name="ELSE_IF_STYLE" value="COMBINE" />
9+
<option name="VARIABLE_NAMING_STYLE" value="CAMEL_CASE" />
10+
<option name="BLANK_LINES_BEFORE_RETURN_STATEMENT" value="1" />
11+
<option name="KEEP_BLANK_LINES_AFTER_LBRACE" value="0" />
12+
<option name="FORCE_SHORT_DECLARATION_ARRAY_STYLE" value="true" />
13+
<option name="SPACE_AROUND_ASSIGNMENT_IN_DECLARE" value="true" />
14+
<option name="PLACE_PARENS_FOR_CONSTRUCTOR" value="1" />
15+
</PHPCodeStyleSettings>
16+
<codeStyleSettings language="GraphQL">
17+
<indentOptions>
18+
<option name="USE_TAB_CHARACTER" value="true" />
19+
</indentOptions>
20+
</codeStyleSettings>
21+
<codeStyleSettings language="HTML">
22+
<indentOptions>
23+
<option name="USE_TAB_CHARACTER" value="true" />
24+
</indentOptions>
25+
</codeStyleSettings>
26+
<codeStyleSettings language="JSON">
27+
<indentOptions>
28+
<option name="INDENT_SIZE" value="4" />
29+
<option name="USE_TAB_CHARACTER" value="true" />
30+
</indentOptions>
31+
</codeStyleSettings>
32+
<codeStyleSettings language="JavaScript">
33+
<indentOptions>
34+
<option name="USE_TAB_CHARACTER" value="true" />
35+
</indentOptions>
36+
</codeStyleSettings>
37+
<codeStyleSettings language="PHP">
38+
<option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" />
39+
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
40+
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" />
41+
<option name="BLANK_LINES_AFTER_PACKAGE" value="1" />
42+
<option name="BLANK_LINES_AFTER_CLASS_HEADER" value="1" />
43+
<option name="BLANK_LINES_BEFORE_CLASS_END" value="1" />
44+
<option name="LAMBDA_BRACE_STYLE" value="2" />
45+
<option name="SPECIAL_ELSE_IF_TREATMENT" value="true" />
46+
<option name="SPACE_AFTER_TYPE_CAST" value="true" />
47+
<option name="CALL_PARAMETERS_WRAP" value="5" />
48+
<option name="CALL_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
49+
<option name="CALL_PARAMETERS_RPAREN_ON_NEXT_LINE" value="true" />
50+
<option name="METHOD_PARAMETERS_WRAP" value="5" />
51+
<option name="METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
52+
<option name="METHOD_PARAMETERS_RPAREN_ON_NEXT_LINE" value="true" />
53+
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
54+
<option name="TERNARY_OPERATION_WRAP" value="5" />
55+
<option name="ARRAY_INITIALIZER_WRAP" value="5" />
56+
<option name="ARRAY_INITIALIZER_LBRACE_ON_NEXT_LINE" value="true" />
57+
<option name="ARRAY_INITIALIZER_RBRACE_ON_NEXT_LINE" value="true" />
58+
<option name="IF_BRACE_FORCE" value="3" />
59+
<option name="DOWHILE_BRACE_FORCE" value="3" />
60+
<option name="WHILE_BRACE_FORCE" value="3" />
61+
<option name="FOR_BRACE_FORCE" value="3" />
62+
<indentOptions>
63+
<option name="USE_TAB_CHARACTER" value="true" />
64+
</indentOptions>
65+
</codeStyleSettings>
66+
<codeStyleSettings language="Twig">
67+
<indentOptions>
68+
<option name="USE_TAB_CHARACTER" value="true" />
69+
</indentOptions>
70+
</codeStyleSettings>
71+
<codeStyleSettings language="neon">
72+
<indentOptions>
73+
<option name="USE_TAB_CHARACTER" value="true" />
74+
</indentOptions>
75+
</codeStyleSettings>
76+
</code_scheme>

0 commit comments

Comments
 (0)