Skip to content

Commit

Permalink
Maintenance: git, codesniffer, phpstan, makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
f3l1x committed Dec 15, 2023
1 parent 362054a commit 5a07968
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
@@ -0,0 +1,16 @@
# EditorConfig is awesome: http://EditorConfig.org

root = true

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

[*.{json,yaml,yml,md}]
indent_style = space
indent_size = 2
10 changes: 10 additions & 0 deletions .gitattributes
@@ -0,0 +1,10 @@
.docs export-ignore
.github export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
Makefile export-ignore
README.md export-ignore
phpstan.neon export-ignore
ruleset.xml export-ignore
tests export-ignore
14 changes: 14 additions & 0 deletions .gitignore
@@ -0,0 +1,14 @@
# IDE
/.idea

# Composer
/vendor
/composer.lock

# Tests
/tests/tmp
/coverage.*
/tests/**/*.log
/tests/**/*.html
/tests/**/*.expected
/tests/**/*.actual
34 changes: 34 additions & 0 deletions Makefile
@@ -0,0 +1,34 @@
.PHONY: install
install:
composer update

.PHONY: qa
qa: phpstan cs

.PHONY: cs
cs:
ifdef GITHUB_ACTION
vendor/bin/phpcs --standard=ruleset.xml --encoding=utf-8 --extensions="php,phpt" --colors -nsp -q --report=checkstyle src tests | cs2pr
else
vendor/bin/phpcs --standard=ruleset.xml --encoding=utf-8 --extensions="php,phpt" --colors -nsp src tests
endif

.PHONY: csf
csf:
vendor/bin/phpcbf --standard=ruleset.xml --encoding=utf-8 --extensions="php,phpt" --colors -nsp src tests

.PHONY: phpstan
phpstan:
vendor/bin/phpstan analyse -c phpstan.neon

.PHONY: tests
tests:
vendor/bin/tester -s -p php --colors 1 -C tests/Cases

.PHONY: coverage
coverage:
ifdef GITHUB_ACTION
vendor/bin/tester -s -p phpdbg --colors 1 -C --coverage coverage.xml --coverage-src src tests/Cases
else
vendor/bin/tester -s -p phpdbg --colors 1 -C --coverage coverage.html --coverage-src src tests/Cases
endif
18 changes: 18 additions & 0 deletions phpstan.neon
@@ -0,0 +1,18 @@
includes:
- vendor/contributte/phpstan/phpstan.neon

parameters:
level: 9
phpVersion: 80100

scanDirectories:
- src

fileExtensions:
- php

paths:
- src
- .docs

ignoreErrors:
18 changes: 18 additions & 0 deletions ruleset.xml
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="Contributte" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
<!-- Rulesets -->
<rule ref="./vendor/contributte/qa/ruleset-8.0.xml"/>

<!-- Rules -->
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
<properties>
<property name="rootNamespaces" type="array">
<element key="src" value="Contributte\Elasticsearch"/>
<element key="tests" value="Tests"/>
</property>
</properties>
</rule>

<!-- Excludes -->
<exclude-pattern>/tests/tmp</exclude-pattern>
</ruleset>

0 comments on commit 5a07968

Please sign in to comment.