Skip to content

Commit

Permalink
Repo: maintenance update (makefile, editorconfig, codeception, codest…
Browse files Browse the repository at this point in the history
…yle, coveralls)
  • Loading branch information
f3l1x committed Jan 11, 2021
1 parent 1a177a3 commit 7ca99da
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ indent_style = tab
indent_size = tab
tab_width = 4

[{*.json,*.yml,*.md}]
[{*.json,*.yaml,*.yml,*.md}]
indent_style = space
indent_size = 2
8 changes: 3 additions & 5 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,7 @@ jobs:

- name: "Coveralls.io"
env:
CI_NAME: github
CI: true
COVERALLS_REPO_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.1.0/php-coveralls.phar
php php-coveralls.phar --verbose --config tests/.coveralls.yml
composer global require php-coveralls/php-coveralls
php-coveralls --coverage_clover=tests/_output/coverage.xml --json_path=coveralls-upload.json -v
37 changes: 19 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
.PHONY: qa lint cs csf phpstan tests coverage
.PHONY: install qa cs csf phpstan tests coverage-clover coverage-html

all:
@awk 'BEGIN {FS = ":.*##"; printf "Usage:\n make \033[36m<target>\033[0m\n\nTargets:\n"}'
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
install:
composer update

# QA
qa: phpstan cs

qa: lint phpstan cs ## Check code quality - coding style and static analysis

lint: ## Check PHP files syntax
vendor/bin/linter src tests

cs: ## Check PHP files coding style
cs:
ifdef GITHUB_ACTION
vendor/bin/codesniffer -q --report=checkstyle src tests | cs2pr
else
vendor/bin/codesniffer src tests
endif

csf: ## Fix PHP files coding style
csf:
vendor/bin/codefixer src tests

phpstan: ## Analyse code with PHPStan
phpstan:
vendor/bin/phpstan analyse -l max -c phpstan.neon src

# Tests

tests: ## Run all tests
tests:
vendor/bin/codecept build
vendor/bin/codecept run --debug

coverage: ## Generate code coverage in XML format
phpdbg -qrr vendor/bin/phpunit tests --colors=always -c tests/coverage.xml
coverage-clover:
vendor/bin/codecept build
phpdbg -qrr vendor/bin/codecept run --coverage-xml

coverage-html:
vendor/bin/codecept build
phpdbg -qrr vendor/bin/codecept run --coverage-html
13 changes: 10 additions & 3 deletions codeception.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
actor: Tester

paths:
# where the tests stored
tests: tests
log: tests/_log

# directory for fixture data
data: tests/_data
support: tests/_helpers

# directory for support code
support: tests/_support

# directory for output
output: tests/_output

bootstrap: _bootstrap.php

Expand All @@ -14,4 +21,4 @@ settings:
coverage:
enabled: true
include:
- src/*
- src/**
6 changes: 5 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
includes:
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
- vendor/phpstan/phpstan-nette/extension.neon
- vendor/phpstan/phpstan-nette/rules.neon
- vendor/phpstan/phpstan-strict-rules/rules.neon
- extension.neon

parameters:
excludes_analyse:
- %rootDir%/../../../tests/_*
- %currentWorkingDirectory%/tests/_*

ignoreErrors:
- '#^Only booleans are allowed in a negated boolean, string\|null given.#'
Expand Down
5 changes: 3 additions & 2 deletions ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
</rule>

<!-- Exclude folders -->
<exclude-pattern>/tests/tmp</exclude-pattern>
<exclude-pattern>/tests/_helpers</exclude-pattern>
<exclude-pattern>/tests/_output</exclude-pattern>
<exclude-pattern>/tests/_support</exclude-pattern>
<exclude-pattern>/tests/_temp</exclude-pattern>
</ruleset>
4 changes: 1 addition & 3 deletions src/Module/NetteDIModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,7 @@ private function createContainer(): void

private function getTempDir(): string
{
$tempDir = $this->path . '/' . $this->config['tempDir'];

return $tempDir;
return $this->path . '/' . $this->config['tempDir'];
}


Expand Down
4 changes: 0 additions & 4 deletions tests/.coveralls.yml

This file was deleted.

4 changes: 2 additions & 2 deletions tests/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/_helpers
/_log
/_output
/_support
/_temp
11 changes: 0 additions & 11 deletions tests/coverage.xml

This file was deleted.

2 changes: 1 addition & 1 deletion tests/functional.suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ modules:
- Contributte\Codeception\Module\NetteApplicationModule:
followRedirects: false
- Contributte\Codeception\Module\NetteDIModule:
tempDir: ../_temp/functional
tempDir: ./../_temp/functional
removeDefaultExtensions: true
configFiles:
- config/config.neon

0 comments on commit 7ca99da

Please sign in to comment.