Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement ownCloud coding standard #22

Merged
merged 1 commit into from
Sep 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ pipeline:
commands:
- make test-php-lint

owncloud-coding-standard:
image: owncloudci/php:7.1
pull: true
commands:
- make test-php-style

build:
image: owncloudci/php:7.1
pull: true
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build
/vendor/
vendor-bin/**/vendor
vendor-bin/**/composer.lock
vendor-bin/**/composer.lock
.php_cs.cache
12 changes: 12 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

$config = new OC\CodingStandard\Config();

$config
->setUsingCache(true)
->getFinder()
->exclude('vendor')
->exclude('vendor-bin')
->in(__DIR__);

return $config;
19 changes: 18 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ all_src=$(src_dirs) $(src_files)

# bin file definitions
PHPLINT=php -d zend.enable_gc=0 vendor-bin/php-parallel-lint/vendor/bin/parallel-lint
PHP_CS_FIXER=php -d zend.enable_gc=0 vendor-bin/owncloud-codestyle/vendor/bin/php-cs-fixer

# start with displaying help
.DEFAULT_GOAL := help
Expand Down Expand Up @@ -51,6 +52,16 @@ test-php-lint: ## Run phan
test-php-lint: vendor-bin/php-parallel-lint/vendor
$(PHPLINT) appinfo lib locking

.PHONY: test-php-style
test-php-style: ## Run php-cs-fixer and check owncloud code-style
test-php-style: vendor-bin/owncloud-codestyle/vendor
$(PHP_CS_FIXER) fix -v --diff --diff-format udiff --allow-risky yes --dry-run

.PHONY: test-php-style-fix
test-php-style-fix: ## Run php-cs-fixer and fix code style issues
test-php-style-fix: vendor-bin/owncloud-codestyle/vendor
$(PHP_CS_FIXER) fix -v --diff --diff-format udiff --allow-risky yes

#
# Dependency management
#--------------------------------------
Expand All @@ -68,4 +79,10 @@ vendor-bin/php-parallel-lint/vendor: vendor/bamarni/composer-bin-plugin vendor-b
composer bin php-parallel-lint install --no-progress

vendor-bin/php-parallel-lint/composer.lock: vendor-bin/php-parallel-lint/composer.json
@echo php-parallel-lint composer.lock is not up to date.
@echo php-parallel-lint composer.lock is not up to date.

vendor-bin/owncloud-codestyle/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/owncloud-codestyle/composer.lock
composer bin owncloud-codestyle install --no-progress

vendor-bin/owncloud-codestyle/composer.lock: vendor-bin/owncloud-codestyle/composer.json
@echo owncloud-codestyle composer.lock is not up to date.
5 changes: 5 additions & 0 deletions vendor-bin/owncloud-codestyle/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"require": {
"owncloud/coding-standard": "^1.0"
}
}