Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
skyzyx committed Jun 10, 2019
1 parent 61d7501 commit fd8d882
Show file tree
Hide file tree
Showing 14 changed files with 1,322 additions and 533 deletions.
5 changes: 2 additions & 3 deletions .php_cs.dist
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,6 @@ return Config::create()
],
'single_line_comment_style' => [
'comment_types' => [
'asterisk',
'hash',
],
],
Expand Down Expand Up @@ -467,7 +466,6 @@ return Config::create()
'phpdoc_separation' => true,
'phpdoc_single_line_var_spacing' => true,
'phpdoc_summary' => true,
'phpdoc_to_comment' => true,
'phpdoc_trim' => true,
'phpdoc_trim_consecutive_blank_line_separation' => true,
'phpdoc_var_annotation_correct_order' => true,
Expand Down Expand Up @@ -516,10 +514,11 @@ return Config::create()
'no_unset_cast' => false,
'not_operator_with_space' => false,
'not_operator_with_successor_space' => false,
'php_unit_size_class' => false,
'php_unit_strict' => false,
'php_unit_test_class_requires_covers' => false,
'php_unit_size_class' => false,
'phpdoc_annotation_without_dot' => false,
'phpdoc_to_comment' => false,
'phpdoc_to_return_type' => false,
'protected_to_private' => false,
'psr0' => false,
Expand Down
40 changes: 34 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ all:

.PHONY: test
test:
bin/phpunit
bin/phpunit --prepend tests/phpunit-xdebug-coverage.php

.PHONY: test-quick
test-quick:
Expand Down Expand Up @@ -111,14 +111,18 @@ push-travis:
#-------------------------------------------------------------------------------
# Linting and Static Analysis

.PHONY: lint
lint:
.PHONY: mkdir
mkdir:
@ mkdir -p reports

.PHONY: phpcsfixer
phpcsfixer:
@ echo " "
@ echo "=====> Running PHP CS Fixer..."
- bin/php-cs-fixer fix -vvv

.PHONY: phpcs
phpcs:
@ echo " "
@ echo "=====> Running PHP Code Sniffer..."
- bin/phpcs --report-xml=reports/phpcs-src.xml -p --colors --encoding=utf-8 $$(find src/ -type f -name "*.php" | sort | uniq)
Expand All @@ -130,30 +134,54 @@ lint:
@ echo " "
@ php tools/reporter.php

.PHONY: analyze
analyze: lint test
.PHONY: lint
lint: mkdir phpcsfixer phpcs

.PHONY: xdebug
xdebug:
bin/phpunit --dump-xdebug-filter tests/phpunit-xdebug-coverage.php

.PHONY: phpcpd
phpcpd:
@ echo " "
@ echo "=====> Running PHP Copy-Paste Detector..."
- bin/phpcpd --names=*.php --log-pmd=$$(pwd)/reports/copy-paste.xml --fuzzy src/

.PHONY: phploc
phploc:
@ echo " "
@ echo "=====> Running PHP Lines-of-Code..."
- bin/phploc --names=*.php --log-xml=$$(pwd)/reports/phploc-src.xml src/ > $$(pwd)/reports/phploc-src.txt
- bin/phploc --names=*.php --log-xml=$$(pwd)/reports/phploc-tests.xml tests/ > $$(pwd)/reports/phploc-tests.txt

.PHONY: phpca
phpca:
@ echo " "
@ echo "=====> Running PHP Code Analyzer..."
- php bin/phpca src/ --no-progress | tee reports/phpca-src.txt
- php bin/phpca tests/ --no-progress | tee reports/phpca-tests.txt

.PHONY: licenses
licenses:
@ echo " "
@ echo "=====> Running Open-Source License Check..."
- composer licenses | grep -v BSD-.-Clause | grep -v MIT | grep -v Apache-2.0 | tee reports/licenses.txt
- composer licenses | grep -v BSD-.-Clause | grep -v MIT | grep -v Apache-2.0 | grep -v ISC | tee reports/licenses.txt

.PHONY: vulns
vulns:
@ echo " "
@ echo "=====> Comparing Composer dependencies against the PHP Security Advisories Database..."
- curl -sSL -H "Accept: text/plain" https://security.symfony.com/check_lock -F [email protected] | tee reports/sensiolabs.txt

.PHONY: psalm
psalm:
@ echo " "
@ echo "=====> Running Psalm..."
- bin/psalm --find-unused-code=always --generate-json-map=./reports/psalm.json --output-format=console --show-info=true --show-snippet=true --stats --threads=$$(nproc) --php-version=7.2

.PHONY: analyze
analyze: lint test phpcpd phploc phpca licenses vulns

#-------------------------------------------------------------------------------
# Git Tasks

Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"sebastian/phpcpd": "^4.0",
"slim/slim": "^3.8",
"squizlabs/php_codesniffer": "dev-master",
"vimeo/psalm": "^3.4",
"wapmorgan/php-code-analyzer": "^1.0"
},
"config": {
Expand Down
Loading

0 comments on commit fd8d882

Please sign in to comment.